-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextInput clear() doesn't work at v0.54.2 #18843
Comments
Thanks for posting this! It looks like your issue may be missing some necessary information. Can you run Thank you for your contributions. |
same issue to me. I just init an entire new React Native app, no require any other third package. Environment
the code in App.js:
what's wrong ?Are you guys all OK ? |
Thank you for reporting this regression. Here's a snack: https://snack.expo.io/@charpeni/textinput-regression |
Have you ever run your code ? Whether in Expo App or IOS Simulator, it doesn't work. @charpeni |
That's the point, I've provided a reproducible example on Snack instead of plain text. You can run this Snack on an older expo SDK version, everything will be fine. |
Duplicate of #18272. |
@charpeni, |
Hey guys, any workaround for this issue? I need to clear a text input in iOS (in Android it seems to be working. I tried textInput.clear() and textInput.setNativeProps({ text: '' }); and both does not work on iOS |
check this #18272 |
Hey, Couldn't find anything that works there. Can you recommend anything specifically? Thanks |
same issue here . Someone found any workaround?? |
Try |
I have the same issue, and |
Add Ref. to your textInput Like: |
Same here |
I am having the same issue as .clear() and setState({input: ''}) do not work. |
Same issue. |
I'm using this:
|
The above mentioned solutions with setTimeout() have not worked for me, but what I used to fix this issue is to create the TextInput inside render() but before return() and assign it to a variable. Then I conditionally show it in my JSX if the form is showing or not. For those who need the form to clear after Submit but stay on the screen, I would recommend a function that changes the form condition from shown to not shown and back to shown again across 10ms or something so that it is virtually indistinguishable to the user. I guess the above solutions work for some people, but this will guarantee to give cleared input fields for everybody still having the issue |
it works |
I had this problem too. But found out that using value={this.state.myValue} will clear it.
|
@keithj0nes Thanks! It work for me. |
@keithj0nes it worked for me. Thanks! |
0.56 same issue |
When I use TextInput as a uncontrolled component, clear() method doesn't work at all. Then I try the version at V0.52.2, everything goes fine
Environment
Environment:
OS: macOS Sierra 10.12.6
Node: 8.9.4
Yarn: 0.24.6
npm: 5.6.0
Watchman: 4.9.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.2 => 0.54.2
Steps to Reproduce
Expected Behavior
Something wrong with TextInput re-implement?
The text was updated successfully, but these errors were encountered: