Splitters
Live previews run the actual library through React Native Web. Examples that need native line measurements use an iOS recording.
Splitters choose source-text tokens for nativeText(). They return an opaque TextMotionSplitter handle used by .split(...).
overlayText() owns actual rendered-line measurement and cannot be combined with any splitter. See Renderers.
words()
words()React Native WebTakes no options. Produces word, spacing, and punctuation tokens using Intl.Segmenter when available, with an internal fallback otherwise. Whitespace preserves layout but does not consume a motion index; visible punctuation can consume one.
Words follow the runtime's segmentation rules. This is not a promise that every language separates words by spaces. The generated token metadata includes isWordLike.
graphemes()
graphemes()React Native WebTakes no options. Produces grapheme-aware tokens for character-level motion. Prefer it over text.split(''), which can break surrogate pairs and combining sequences.
The fallback handles common emoji sequences and decomposed Hangul such as 한 without normalizing the source, but does not implement every Unicode grapheme rule. Some complex-script conjuncts can still split. See Segmentation before relying on exact locale boundaries.
lines() — experimental
lines()React Native WebTakes no options. Splits at explicit \n boundaries and preserves newline text in the token's source range. It does not measure automatic wrapping caused by width, fonts, or font scaling.
Tokens have metadata: { experimental: true, mapping: 'newline-only' }. Use overlayText() and lineReveal() when you need the lines React Native actually rendered.
custom(split)
custom()React Native WebReturn strings or token objects. String results get inferred source ranges by searching forward from the previous token's end. Return explicit ranges when matching is ambiguous or metadata matters. Ranges use JavaScript string indices (UTF-16 code units), with an exclusive end.
Preserve all characters and spacing that should remain visible. A custom splitter does not repair or validate product-specific segmentation decisions. The optional context is part of the callback shape; recipe components currently call splitters without passing a locale, so there is no component locale prop.
Token type
TextMotionToken is exported for typed integrations:
A splitter handle does not expose a public .split() method or its internal descriptor. Pass the handle to the recipe builder instead.
