Playback
Live previews run the actual library through React Native Web. Examples that need native line measurements use an iOS recording.
Choose who owns playback: the component, an event, or an app-owned Reanimated shared value.
Autoplay and text updates
AutoplayReact Native WebOn mount, visible animated tokens play from their initial styles to their final styles. Passing controls keeps this mount autoplay; it does not make a component wait for its first command.
- Rerendering the same text with the same recipe preserves playback already in progress.
- Changing text replays the affected token animations, including replacements with the same token shape.
- Changing effective effects, timing, or motion configuration resets affected tokens and uses the new configuration. Function-valued motion options, such as easing functions, are reference-sensitive; reuse their references when playback should continue.
- Whitespace and static tokens keep their layout but do not animate or consume a motion index.
Text changes are enter-only. There is no exit animation, crossfade, or old/new token transition. In external-progress mode, new text uses the current shared value instead of starting autoplay. Commands always target the currently rendered text.
Create recipe components outside render so React can preserve their identity. See Recipes.
Event-driven controls
play() / replay() / reset() / stop()React Native WebuseTextMotionControls() returns a stable command channel. Pass it explicitly to each component that should receive commands.
Commands broadcast to every mounted component attached to that controls object; each uses its own recipe. Commands are not a stored playback state or a queue for future mounts. Components unsubscribe when detached or unmounted.
stop() followed by play() is not a precise pause/resume API and does not promise the original remaining schedule. Use replay() for a complete restart. With the explicit reduced-motion final-state policy active, the final visible state takes priority over reset and replay.
Use controls for buttons, screen-focus events wired by your app, or onboarding steps. There is no provider/context playback API or public component-ref playback API.
App-owned progress
progressReact Native WebUse a Reanimated SharedValue<number> when text should follow another animation, a scroll value, or a gesture value your app already owns.
0 renders initial styles and 1 renders final styles. Finite values outside that range are clamped; non-finite values are treated as 0. Passing progress disables internal autoplay and ignores the recipe's .motion() configuration for that instance. Set duration and easing where you update the shared value.
The value represents the whole effect timeline. For a token delay d and largest token delay D in seconds, the current mapping uses a fixed per-token span of 1.0:
Timelines still shape when each token starts. Whitespace does not take a delay slot. This is not a per-token duration API.
Typewriter progress
typewriter() + progressReact Native WebThe preview shows timeline progress and visible characters separately. The character count excludes spaces and includes punctuation and emoji; it updates during playback and when you move progress backward.
typewriter() shows a token once its local progress is greater than zero. Progress is not the fraction of characters visible: for ten visible characters with stagger(0.05), all are visible just after about 0.310345. Moving progress backward across a start threshold hides that character again. Use a linear external timing curve for evenly spaced threshold crossings in time.
The effect preserves the completed phrase's layout. It does not add a cursor or provide text streaming. See Effects and Examples.
Boundaries
controls and progress are mutually exclusive in TypeScript and at runtime. There are no first-class pause, seek, reverse, scroll, gesture, in-view, or screen-focus drivers. Integrate your own events with controls or your own continuous values with progress.
For reduced-motion behavior, see Accessibility. For supported text and accessibility props, see Component props.
