I have an Android app built with React native.
The app has a TextInput and a submit button.
When typing in the text input, the default keyboard starts suggesting words (not sure how this feature is called - auto complete or predictive text).
When clicking submit, the data is stored and the TextInput is cleared via the "clear()" method of the TextInput. For example:
this.refs.textInput.clear();
For some reason, the "predictive text" is not cleared after the "clear()" method is called. As a result, when the user start typing again, the predictive text continues from where it stopped and the user has to clear the text input.
Note: the text input is multi-line. Not sure if it has anything to do with the problem.
Here is example for the same issue:
Example
See attached image for more details:
I found a solution:
On submit, I change the keyboard and revert back, like in the following code.
this.refs.textInput.setNativeProps({keyboardType:"email-address"});
this.refs.textInput.setNativeProps({keyboardType:"default"});
来源:https://stackoverflow.com/questions/37798584/react-native-when-submitting-a-text-input-in-android-the-word-suggestions-are