Clear function on TextInput does not call onChange
See original GitHub issueDescription
When calling clear function on TextInput, it does not call onChange or onChangeText method.
Reproduction Steps and Sample Code
https://snack.expo.io/ry1B5ZR2g
Solution
What needs to be done to address this issue? Ideally, provide a pull request with a fix.
Additional Information
- React Native version: 0.42.0
- Platform: both
- Development Operating System: Mac
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:7 (2 by maintainers)
Top Results From Across the Web
onChange not firing when deleting the input value
I'm facing an issue where i cannot get the onChange to fire when i delete the input value ...
Read more >onchange event is not triggered when clear an input field
When you clear the account name the contents changes but focus is still on input and so it does not fire onChange event....
Read more >On-change not triggered when input cleared - OutSystems
I have an input box which is linked to an autocomplete widget. When the input box is blank, I show a button with-which...
Read more >TextInput - React Native
onChangeText . Callback that is called when the text input's text changes. Changed text is passed as a single string argument to the...
Read more >Solved: OnChange() of a textInput doesn't work when enter
If I am in the Text Input and at any time I push a non numeric key, then I step out of the...
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 would suggest you change your code to
If anyone is still looking for an answer to this, putting the
onChangeTextfunction outside of the JSX (eg.this.onChangeText), then calling it with an empty string after a clear seems to work (RN 0.54.1).