DocsHooks & utilities
Text segments
Conservative whole-run shaping fallbacks for text motion.
Conservative shaping-safe motion segmentation with whole-run fallbacks.
Free (MIT)Version 1.0.0Released 27 Oct 2026iOS and Android
When to use it
- Share conservative motion segmentation across text effects.
When not to use it
- This is not a linguistic tokenizer or a general Unicode grapheme implementation.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add text-segments- Adds
components/swipeui/lib/text-segments.ts.
Usage
import { segmentMotionText } from '@/components/swipeui/lib/text-segments';
segmentMotionText('Hello world', 'word'); // ['Hello', ' ', 'world']
segmentMotionText('مرحبا'); // one complete shaped runJoined scripts, combining marks, emoji sequences and bidi controls retain a whole text run. This deliberate fallback protects readable glyphs; it is not a general linguistic tokenizer. Use the shared helper instead of splitting contextual glyphs to force an effect.
Accessibility
- This helper adds no accessibility behavior; the rendered component owns its semantics.
Motion
- Static on its own; any movement comes from the parent that animates it.
- No custom movement is configured by this item.
Performance
- Pure string helpers; no animation frames, timers or views.
Notes for AI
- Joined scripts, combining marks, emoji sequences and RTL deliberately retain the complete text run.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.