Stroke/outline text for React Native (New Architecture) on iOS, Android, and Web.
npm install @whetware/react-native-stroke-text@whetware/react-native-stroke-textStroke/outline text for React Native, implemented as a Nitro Hybrid View (Fabric / New Architecture only).
- iOS: ✅ (Swift)
- Android: ✅ (Kotlin)
- Web: ✅ (JS fallback)
- Old architecture: ❌ (not supported)
``sh`
pnpm add @whetware/react-native-stroke-text react-native-nitro-modules
This package requires the New Architecture. Ensure it’s enabled in your app before installing.
`tsx
import { StrokeText } from '@whetware/react-native-stroke-text'
export function Example() {
return (
strokeColor="#000"
numberOfLines={1}
ellipsizeMode="tail"
style={{ fontSize: 48, fontWeight: '800', color: '#fff' }}
>
Hello
)
}
`
To avoid the outline getting clipped during animations (especially on Android), StrokeText keeps theceil(strokeWidth) / 2
stroke inside the component bounds by applying an internal inset of . It then
uses matching negative margins so the layout footprint matches a normal .
- Generate Nitro bindings: pnpm specspnpm typecheck`
- Typecheck: