mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Motivation is the same as in https://github.com/facebook/react-native/pull/24927 - when building a custom textinput (eg with rich text editing), one needs custom text processing logic. `ReactTextInputShadowNode` contains https://github.com/facebook/react-native/blob/6671165f69e37a49af8b709b4807f9049f7606c3/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java#L211 where an instance of `ReactTextUpdate` is created. For the custom use case, we'd like to just change the usage of [`spannedFromShadowNode()`](https://github.com/facebook/react-native/blob/6671165f69e37a49af8b709b4807f9049f7606c3/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java#L217) to our own implementation. from there: It's easy to subclass `ReactTextInputShadowNode` and override `public void onCollectExtraUpdates()` but the problem is that the method accesses private members. It also means overriding more code than necessary as we only care for `spannedFromShadowNode()`. Solution might be changing the members to protected, but that seemed weird because there are already setters for them. Creating getters also seemed weird, as we'd end up having unused getters hanging around. So the second way which I find nicer is changing `protected static Spannable spannedFromShadowNode(ReactBaseTextShadowNode textShadowNode, String text)` to just `protected` since that will allow subclasses to override just this behavior. ## Changelog [Android] [Added] - allow custom spannedFromShadowNode in ReactTextInputShadowNode subclasses Pull Request resolved: https://github.com/facebook/react-native/pull/24995 Differential Revision: D15468066 Pulled By: cpojer fbshipit-source-id: 73d5f0b9e06f3e02a03bf9db5effac62cecc80c4
Building React Native for Android
See the docs on the website.
Running tests
When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see Testing.