React Native Discussion Forums

There's no such thing as a stupid question. Ask. Discuss. Learn.

How do we change text input's value in react native

I would like to change the text input's value without using setstate.
Please How can I do

Zaki Tutu 9 months ago
  • Karthikeyan-vk

    If you do not want to use setState means you do not want your component to render. But how do you expect to see a visible change of the value in the text input without re rendering of the component. React re renders the parts of the component and not the entire component. So I think you don't have to worry about re rendering of the component. If you still don't want to use setState, you can change the date in the text input using this.state.somepropertyname and use this.forceUpdate() when you are done with the changes and want your component to re render. But have to warn you that using forceUpdate is discouraged and use only when it is absolutely required.

  • Metal Gabe

    First, a rant, why in the are forums hidden? There should be a link at the top nav readily available. Secondly, when I get to the forum, why isn't there an EASILY VISIBLE button to ask a new question. The tag line for the React Native DISCUSSION Forums is "Ask. Discuss. Learn." How do we ask without having a way to ACTUALLY ask a question?

    With that out of the way, I came here to seek help on why the TextInput's value from onChangeText is consistently 1 character behind the value that I have stored in my local state. If anyone has a solution, please let me know.

  • Whitelisted Links