[0.54] TextInput.setNativeProps({text: ''}) no longer works
See original GitHub issueEnvironment
Environment:
OS: macOS Sierra 10.12.6
Node: 8.7.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: 0.54.0 => 0.54.0
Expected Behavior
Calling textInputRef.setNativeProps({text: ''})
or textInputRef.clear()
clears the text input – this was working in previous versions (before the <Text>
rewrite in 0.54
).
Actual Behavior
Calling textInputRef.setNativeProps({text: ''})
or textInputRef.clear()
does nothing.
Steps to Reproduce
Repro here: https://github.com/Leeds-eBooks/react-native-0.54-text-input-clear-repro
Issue Analytics
- State:
- Created 6 years ago
- Reactions:35
- Comments:23 (3 by maintainers)
Top Results From Across the Web
Direct Manipulation - React Native
setNativeProps is the React Native equivalent to setting properties directly on a DOM node. Use setNativeProps when frequent re-rendering ...
Read more >React Native - TextInput.setNativeProps isn't triggering ...
I am trying to clear a text input using setNativeProps({ text: '' }) which according to the documentation is a common way to...
Read more >react native textinput ref value - You.com | The AI Search ...
The value to show for the text input. TextInput is a controlled component, which means the native value will be forced to match...
Read more >Unable to setNativeProps the style in <text> component - Reddit
setNativeProps () is not working, everytime i try to change the Text style ... }>as</Text> <TextInput ref={ refUser } style={ [styles.input] ...
Read more >TextInput · React Native Paper
A component to allow users to input text. ... Active underline color of the input. outlineColor ... The number of lines to show...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am using v0.55.3 and I’ve encountered the same issue.
textInputRef.clear()
andtextInputRef.setNativeProps({text: ''})
only seem to work on Android. On iOS nothing happens.v0.55.3 a dirty solution for iOS