mirror of
https://github.com/react/react-native.git
synced 2026-10-01 01:37:59 +08:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56720 Introduces a generic TextEffect system that lets apps register custom text span effects without modifying React Native core. This can serve for use cases like `react-native-live-markdown`, or product specific effects. The implementation is pretty dumb right now. It's just a marker, where we can add some JSON serializable data, to be serialized during Spannable creation on JS side MapBuffer. **JS API:** ```js import requireNativeTextEffect from 'react-native/Libraries/Text/requireNativeTextEffect'; const Spoiler = requireNativeTextEffect<{}>('RCTSpoiler'); <Text>Normal <Spoiler>hidden text</Spoiler></Text> ``` **Android registration** (via FabricUIManager): ```kotlin val fabricUIManager = UIManagerHelper.getUIManager( context, UIManagerType.FABRIC) as? FabricUIManager fabricUIManager?.textEffectRegistry?.register("RCTSpoiler") { props -> MyCustomSpan() } ``` Changelog: [Internal] Reviewed By: javache Differential Revision: D98812222 fbshipit-source-id: 7000a0452b7592cdc2b26e7eaa37ec95736efce4