@rocapine/react-native-onboarding
Changelog
All notable changes to @rocapine/react-native-onboarding are documented here.
[Unreleased]
[1.18.0] - 2026-05-06
Added
fontStyle: "normal" | "italic"on Text-rendering ComposableScreen UIElements. Top-level prop onTextElementProps,ButtonElementProps,InputElementProps. Per-item propitemFontStyleonRadioGroupElementPropsandCheckboxGroupElementProps. All optional; Zod-validated asz.enum(["normal", "italic"]).optional().setVariablebutton action —Button.actionsaccepts a new entry{ type: "setVariable", name: string, value: string, label?: string }that writes directly into the variable map. Useful to capture which branch a user chose before"continue"triggersresolveNextStepNumber. Stored shape matches existing element writes ({ value, label }).OnboardingProgressContext.getVariables()— synchronous getter that returns the latest variable snapshot from a ref. Use it insideonContinuehandlers to feedresolveNextStepNumberwith values just written bysetVariable, since React state reads are stale within the same tick.
Fixed
- Branching with same-tick
setVariable+continue— variables were read from React state in the handler that just wrote them, so branch conditions evaluated against pre-set values and fell through to the default target.setVariablenow updates a ref synchronously alongside the state setter;getVariables()exposes the fresh snapshot.
Backend note: The
onboarding-studioserver must mirror the newfontStyle(anditemFontStylefor RadioGroup/CheckboxGroup) field on the affected UIElement schemas, and the newsetVariablebutton action variant in theButtonActionunion and CMS editor.
[1.17.1] - 2026-05-04
Fixed
- Runtime fonts manifest —
registerFontsnow accepts the array shape returned byonboarding-studio({ family: [{ weight, style, url }, ...] }) in addition to the legacy{ family: { weightKey: url } }map. Previously, iterating an array withObject.entriesproduced numeric indices ("0".."N") as weight keys and passed the variant object asurl, causing native expo-font to throwloadSingleFontAsync expected resource of type Assetand warnings likeFailed to load font "X" weight 8 from [object Object]. The newnormalizeFamilyVariantsdedupes by weight and prefersstyle: "normal"variants over italic.
Added
FontVariantEntryandFontFamilyManifestInputexported types.FontsManifestwidened toRecord<string, FontFamilyManifestInput>so array-shape manifests are typed end-to-end.
[1.17.0] - 2026-04-30
Added
- Runtime font download + load —
Onboardingresponse now accepts an optional top-levelfonts?: FontsManifestfield, whereFontsManifest = Record<string, Partial<Record<FontWeightKey, string>>>. Font files are downloaded and registered viaexpo-font(optional peer dependency) when the onboarding payload is fetched.FontWeightKeyaccepts named (regular,medium,semibold,bold,extrabold) or numeric (100…900) keys, normalized internally. OnboardingProvider.fontsFallback?: ReactNode— rendered while the onboarding payload is fetched and remote fonts are downloading. Defaults tonull.<FontLoaderGate fonts={...} fallback={...}>— standalone gate component that registers fonts and exposes aFontRegistryvia context, for hosts that do not useOnboardingProvider.useFontRegistry()anduseResolvedFontFamily(family, weight)hooks for resolving afamily + weightrequest to the registered font name with a closest-weight fallback (CSS-style font matching).- New exports:
FontWeightKey,FontFamilyManifest,FontsManifest,FontRegistry,registerFonts,resolveFontFamily,normalizeWeight,FontRegistryProvider,useFontRegistry,useResolvedFontFamily,FontLoaderGate.
Changed
OnboardingProvidernow wraps children in an internalOnboardingDataGate(useQuery) followed byFontLoaderGate, blocking render until the onboarding payload is fetched and any declared fonts finish loading. The previousprefetchQuerycall is removed.
Backend note:
onboarding-studioshould mirror the newOnboarding.fontsfield — see the migration prompt in the PR description. ComposableScreen UIElement schemas are unchanged; this is an API-level addition.
[1.16.0] - 2026-04-29
Added
Button.actionsordered action array —ButtonElement.propsnow acceptsactions?: ButtonAction[], whereButtonAction = "continue" | { type: "custom"; function: string; variables?: string[] }. Actions run sequentially on press;awaits any returned Promise; aborts the remaining chain on a thrown error;"continue"is terminal.OnboardingProvider.customActionsprop —Record<string, CustomActionHandler>whereCustomActionHandler = (args: { variables: Record<string, ComposableVariableEntry | undefined> }) => void | Promise<void>. Functions are invoked by name fromButton.actions{ type: "custom", function, variables }, receiving the requested variables filtered from the live ComposableScreen variable map.- New exports:
ButtonAction,CustomButtonAction,ButtonActionSchema,CustomButtonActionSchema,CustomActionHandler,CustomActions,ComposableVariableEntry.
Changed
Button.action?: "continue"is now deprecated but still accepted as a back-compat alias. Whenactionsis absent andaction === "continue", runtime treats it asactions: ["continue"]. CMS payloads should migrate toactions.
Backend note: The
onboarding-studioserver must mirror the newButton.actionsfield in itsComposableScreenUIElement schema (Zod) and CMS editor (ordered list of"continue"or{ type: "custom"; function: string; variables?: string[] }). The legacyactionfield should be kept readable for historical payloads.
[1.15.0] - 2026-04-28
Added
SafeAreaViewUIElement — new container element mirroringreact-native-safe-area-context'sSafeAreaView. Props:mode?: "padding" | "margin",edges?accepting either("top" | "right" | "bottom" | "left")[]or a per-edge object mapping each edge to"off" | "additive" | "maximum". ExtendsBaseBoxProps. Exports:SafeAreaViewElementProps,SafeAreaEdge,SafeAreaEdgeMode,SafeAreaViewElementPropsSchema.
Backend note: The
onboarding-studioserver must be updated to accept and validate the new"SafeAreaView"element type in theComposableScreenUIElement union. MirrorSafeAreaViewElementPropsSchema(with the strict per-edge object) in the backend validation layer and addSafeAreaViewto the CMS editor element-type picker. Run the schema-sync/publish process inonboarding-studio(regenerate Zod schemas, bump validator package, deploy) before publishing this SDK release so CI and runtime payloads do not drift.
[1.14.0] - 2026-04-28
Added
ZStackUIElement — new container type that stacks children on top of each other using absolute positioning. Props: allBaseBoxPropsfields (width, height, padding, borderRadius, overflow, backgroundGradient, etc.). Children fill the container bounds by default, enabling image-with-overlay patterns.ZStackElementPropsandZStackElementPropsSchemaexported from the headless package.
[1.13.1] - 2026-04-28
Added
ZStackUIElement — new container type that stacks children on top of each other using absolute positioning. Props: allBaseBoxPropsfields (width, height, padding, borderRadius, overflow, backgroundGradient, etc.). Children fill the container bounds by default, enabling image-with-overlay patterns.ZStackElementPropsandZStackElementPropsSchemaexported from the headless package.
[1.13.0] - 2026-04-28
Added
-
backgroundGradientonBaseBoxProps— all UIElement types now accept an optionalbackgroundGradientprop alongsidebackgroundColor. Accepts aGradientBackgrounddiscriminated union (currentlytype: "linear"). -
LinearGradientConfig— linear gradient config:fromandtoare namedGradientEdgepositions ("top","bottom","left","right","topLeft","topRight","bottomLeft","bottomRight");stopsis an array of{ color: string; position?: number }(min 2 stops, position 0–1). -
Exports —
GradientBackground,GradientEdge,GradientStop,LinearGradientConfig, andGradientBackgroundSchemaexported from the headless package.
[1.12.0] - 2026-04-28
Added
-
Multi-path branching — every step schema now includes a
nextStepfield (nullable, defaults tonull). Whennull, navigation proceeds linearly. When set, an ordered list ofbranchesis evaluated; the first matching branch wins and navigation jumps tobranch.targetStepId. If no branch matches,defaultTargetStepIdis used as a fallback; if that is absent or unresolved, linear progression applies. -
Branch.conditionnullable — anullcondition on a branch is treated as unconditional (always matches). Useful as a final catch-all entry after guarded branches. -
Condition schema —
LeafConditionSchema,ConditionGroupSchema,BranchSchema, andNextStepSchemaadded tocommon.types.tsand exported from the package. Supported operators:eq,neq,gt,lt,gte,lte,contains,in,not_in. Conditions nest recursively viaConditionGroup(logic: "and" | "or",conditions: Array<LeafCondition | ConditionGroup>).ConditionValueSchemaacceptsstring | number | boolean | Array<string | number | boolean>. -
BaseStepTypeSchema— all per-step Zod schemas now extend a single shared base (id,name,displayProgressHeader,customPayload,continueButtonLabel,buttonSection,figmaUrl,nextStep) via.extend(). Previously each schema declared these fields independently. -
variableNameonQuestionandPicker— optionalz.string().min(1)field. When set, the answer selected on that step is stored in the global variable store under this key and becomes available to branch conditions on subsequent steps. -
Variable store —
OnboardingProgressContextgainsvariables: Record<string, any>andsetVariable(name, value). The store is written by the host app'sonContinuehandler and read byresolveNextStepNumber. -
resolveNextStepNumber(currentStep, variables, steps)— new exported pure function. Returns the 1-indexed step number to navigate to, ornullwhen the flow ends. Resolution order: matching branch →defaultTargetStepId→ linear next →null. Self-referencing targets (branch or default pointing back to the current step) are silently skipped to prevent infinite-loop routing. -
evaluateConditionmodule — pure condition-evaluation logic extracted tosrc/evaluateCondition.tswith no domain dependencies. ExportsevaluateLeaf,evaluateCondition,isConditionGroup, and theConditiontype. -
Test suite — Vitest added as a dev dependency. 75 tests across
evaluateCondition.test.tsandresolveNextStepNumber.test.tscovering all operators, AND/OR nesting up to 3 levels, branch ordering, unconditional branches,defaultTargetStepIdfallback, self-loop guard, and edge cases.
Changed
NextStepSchema.branchesnow defaults to[]— omittingbranchesfrom anextStepobject is valid; callers can set onlydefaultTargetStepId.
[1.11.1] - 2026-04-27
Changed
-
BaseBoxPropsexpanded — all UIElement schemas now inheritminWidth,maxWidth,minHeight,maxHeight,flexShrink,flexGrow,backgroundColor, andoverflowfrom the base. Previously these were missing or inconsistently defined per element. -
StackElement(YStack/XStack) props — now correctly extendsBaseBoxPropsinstead of declaringwidth/heightas number-only standalone fields.widthandheightnow acceptnumber | string(e.g."100%"). Stack-specific props retained:gap,alignItems,justifyContent,flexWrap. -
TextElementprops — now correctly extendsBaseBoxPropsinstead of duplicating margin/padding/border fields. Text-specific props retained:content,mode,fontSize,fontWeight,fontFamily,color,textAlign,letterSpacing,lineHeight. -
InputElementprops — addedfontFamily,lineHeight,letterSpacing. -
ButtonElementprops — removed redundantalignSelfoverride (now inherited fromBaseBoxPropswith the full enum). -
RiveElementprops — renamedautoplay→autoPlay(consistent casing with all other elements). -
CarouselElementprops — added dot style props:dotColor,activeDotColor,dotWidth(default20),dotHeight(default4),dotsGap(default8),dotsMarginTop(default12).
[1.11.0] - 2026-04-24
Added
CarouselUIElement schema forComposableScreen— new discriminated-union variant withtype: "Carousel". Takeschildren: UIElement[]— any renderable UIElement tree as slide content (same recursive system asYStack/XStack). Props:carouselType("normal"|"left-align"|"parallax"|"stack", default"normal"),autoPlay(boolean, defaultfalse),autoPlayInterval(number ms, default3000),loop(boolean, defaulttrue),showDots(boolean, defaulttrue),height(number, optional), plus allBaseBoxProps. Validated byCarouselElementPropsSchema(Zod). ExportsCarouselElementPropstype.
Backend note: The
onboarding-studioserver must be updated to accept and emit theCarouselUIElementvariant inComposableScreenpayloads. MirrorCarouselElementPropsSchemain the backend validation layer and addCarouselto the CMS element-type picker.
[1.10.0] - 2026-04-23
Added
DatePickerUIElement schema forComposableScreen— new discriminated-union variant withtype: "DatePicker". Props:variableName(string, optional — context key; selected date written as ISO 8601 string),defaultValue(ISO string, optional),minimumDate/maximumDate(ISO strings, optional),mode("date"|"time"|"datetime", default"date"),display("default"|"spinner"|"calendar"|"clock"|"compact"|"inline", optional — platform-specific),textColor,accentColor,locale(strings, optional), plus allBaseBoxProps. Validated byDatePickerElementPropsSchema(Zod).
Backend note: The
onboarding-studioserver must be updated to accept and emit theDatePickerUIElementvariant inComposableScreenpayloads. MirrorDatePickerElementPropsSchemain the backend validation layer and addDatePickerto the CMS element-type picker.
[1.9.0] - 2026-04-22
Added
CheckboxGroupUIElement schema forComposableScreen— new discriminated-union variant withtype: "CheckboxGroup". Props:variableName(string, optional — context key; selected values written as a JSONstring[]),items(Array<{ label: string; value: string }>, required, min 1),defaultValues(string[], optional — must reference valid item values),gap(number),direction("vertical"|"horizontal"), per-item styling (itemBackgroundColor,itemSelectedBackgroundColor,itemBorderColor,itemSelectedBorderColor,itemBorderRadius,itemBorderWidth,itemColor,itemSelectedColor,itemFontSize,itemFontWeight,itemFontFamily,itemPadding,itemPaddingHorizontal,itemPaddingVertical), plus allBaseBoxProps. Validated byCheckboxGroupElementPropsSchema(Zod); includessuperRefinechecks for unique item values and validdefaultValuesentries (per-index error paths).
Backend note: The
onboarding-studioserver must be updated to accept and emit theCheckboxGroupUIElementvariant inComposableScreenpayloads. MirrorCheckboxGroupElementPropsSchemain the backend validation layer and addCheckboxGroupto the CMS element-type picker.
[1.8.1] - 2026-04-22
Added
alignSelfprop onBaseBoxProps— available on all elements that extendBaseBoxProps(Input,RadioGroup,Image,Lottie,Rive,Icon,Video). Accepts"auto" | "flex-start" | "flex-end" | "center" | "stretch" | "baseline".
Changed
alignSelfonStackElement—StackElementPropsandStackElementPropsSchemanow includealignSelf(same enum) in addition to the existingalignItems.
[1.8.0] - 2026-04-21
Added
ButtonUIElement schema forComposableScreen— new discriminated-union variant withtype: "Button". Props:label(string, required, non-empty),action("continue", optional — defaults to callingonContinue),variant("filled"|"outlined"|"ghost"),backgroundColor,color,fontSize,fontWeight,fontFamily,textAlign,alignSelf, plus allBaseBoxProps. Validated byButtonElementPropsSchema(Zod).RadioGroupUIElement schema forComposableScreen— new discriminated-union variant withtype: "RadioGroup". Renders a group of radio options from an inlineitems: Array<{ label: string; value: string }>array. Props:variableName(string, optional — context key),defaultValue,gap,direction("vertical"|"horizontal"), allBaseBoxProps, and per-item styling (itemBackgroundColor,itemSelectedBackgroundColor,itemBorderColor,itemSelectedBorderColor,itemBorderRadius,itemBorderWidth,itemColor,itemSelectedColor,itemFontSize,itemFontWeight,itemFontFamily,itemPadding,itemPaddingHorizontal,itemPaddingVertical). Validated byRadioGroupElementPropsSchema(Zod).- Structured variable entries —
ComposableVariableEntrytype introduced:{ value: string; label?: string }. ThecomposableVariablescontext map is nowRecord<string, ComposableVariableEntry>instead ofRecord<string, string>.RadioGroupwrites bothvalue(raw) andlabel(human-readable) when an item is selected. Expression interpolation inTextelements resolveslabelfirst, falling back tovalue.
Note on semver: The
composableVariablestype changed fromRecord<string, string>toRecord<string, ComposableVariableEntry>. This is published as a minor bump (not major) becausecomposableVariablesis an internal context value not part of the public API contract. Existing consumers remain unaffected — access.valueon the entry for the same string result.
Changed (internal)
ComposableScreenelement types and Zod schemas split intoelements/subfolder — one file per element type.types.tsnow assembles theUIElementunion andUIElementSchemaby importing individual schemas.
Backend note: The
onboarding-studioserver must be updated to accept and emit theRadioGroupUIElementvariant inComposableScreenpayloads. MirrorRadioGroupElementPropsSchemain the backend validation layer and addRadioGroupto the CMS element-type picker.
[1.7.0] - 2026-04-21
Added
fontFamilyprop onTextUIElement — optionalfontFamily?: stringadded to theTextvariant ofUIElementand toTextElementPropsSchema(Zod). Pass any font family name loaded viaexpo-font(or a system font) to apply a custom typeface to a text node.
Backend note: The
onboarding-studioserver should be updated to accept and emitfontFamilyonTextUIElement props, and to expose a font-family input in the CMS text-element editor.
[1.6.0] - 2026-04-21
Added
InputUIElement schema forComposableScreen— new discriminated-union variant withtype: "Input". Renders a<TextInput>that writes its value into shared context viavariableName. Props:variableName(string, optional — context key),placeholder,placeholderColor,defaultValue,keyboardType,returnKeyType,autoCapitalize,secureTextEntry,maxLength,multiline,numberOfLines,editable, plus typography and layout props (color,fontSize,textAlign,padding*) and allBaseBoxProps(backgroundColor,borderWidth,borderRadius,borderColor,width,height,opacity,margin*). Validated byInputElementPropsSchema(Zod).- Variable context —
OnboardingProgressContextnow holdscomposableVariables: Record<string, string>andsetComposableVariable. Values written byInputelements survive navigation betweenComposableScreensteps. - Expression mode for
Textelements —mode?: "plain" | "expression"prop added toTextElementPropsSchema. When"expression",{{variableName}}patterns incontentare interpolated fromcomposableVariablesat render time. Default ("plain") is unchanged.
Backend note: The
onboarding-studioserver must be updated to accept and emit theInputUIElementvariant inComposableScreenpayloads, and to support themodeprop onTextelements. MirrorInputElementPropsSchemaand the updatedTextElementPropsSchemain the backend validation layer and addInputto the CMS element-type picker.
[1.5.0] - 2026-04-21
Added
IconUIElement schema forComposableScreen— new discriminated-union variant withtype: "Icon". Props:name(string, required — Lucide icon name),size(number),color(string),strokeWidth(number), plus allBaseBoxProps. Validated byIconElementPropsSchema(Zod).VideoUIElement schema forComposableScreen— new discriminated-union variant withtype: "Video". Props:url(string, required),autoPlay(boolean),loop(boolean),muted(boolean),controls(boolean), plus allBaseBoxProps. Validated byVideoElementPropsSchema(Zod).
Backend note: The
onboarding-studioserver must be updated to accept and emitIconandVideoUIElementvariants inComposableScreenpayloads. MirrorIconElementPropsSchemaandVideoElementPropsSchemain the backend validation layer and add both types to the CMS element-type picker.
[1.4.0] - 2026-04-21
Added
LottieUIElement forComposableScreen— renders a Lottie animation from a remote JSON URL vialottie-react-native(optional peer dep). Supportssource(required),autoPlay,loop,speed, and allBaseBoxProps(width,height,opacity,margin*,padding*,border*).RiveUIElement forComposableScreen— renders a Rive animation from a remote.rivURL viarive-react-native(optional peer dep). Supportsurl(required),autoplay,fit,alignment,artboardName,stateMachineName, and allBaseBoxProps.
Changed
BaseBoxPropsrefactor —width,height,opacity,margin*,padding*,borderWidth,borderRadius, andborderColorare now defined once in a sharedBaseBoxPropstype andBaseBoxPropsSchema, then extended byImage,Lottie, andRiveelement schemas. Stack and Text schemas are unchanged.
[1.3.0] - 2026-04-17
Added
ImageUIElement forComposableScreen— renders a remote image via React Native<Image>. Supportsurl(required),width,height,aspectRatio,resizeMode(cover|contain|stretch|center),borderRadius,borderWidth,borderColor,opacity, and all margin / padding shorthand props.aspectRatioprop onImageelements — applied as a size fallback whenheightis omitted; defaults to16/9so images never collapse to zero height.
[1.2.0]
Added
- ComposableScreen (under development) — new step type that defines a
declarative UI element tree (
YStack,XStack,Text) driven entirely from the CMS. TheUIElementtype and its Zod schema now support the following props on stack elements:borderWidth,borderRadius,borderColor,overflow,opacity,margin,marginHorizontal,marginVertical,width,height,minWidth,maxWidth,minHeight,maxHeight. Text elements gainmargin,marginHorizontal,marginVertical,borderWidth,borderRadius,borderColor, andopacity.
Note:
ComposableScreenis under active development. The schema may change before it is considered stable.