In my react-native app i have an API that I'm retrieving data from, and I'm setting the data inside my input values, user should be able to edit those inputs and update, but when i try to type in the input it won't type anything and the value stays as it is, here is the TextInput code:
<TextInput
placeholder= Email
value={this.state.info.email}
onChangeText={email => this.setState({ email })}/>
Since I don't think email is the only prop of your state.info
I recommend you to use setState()
properly, in order to modify just that field. According to immutability and ES6, something like:
<TextInput
placeholder="Email"
value={this.state.info.email}
onChangeText={text =>
this.setState(state => ({
info: {
...state.info,
email: text
}))
}
/>;
Read more about handling TextInput
here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With