I am a newcomer to react native and struggling with the following issue. I am doing an update function, once a user is selected then this user's data is populated into their dedicated fields TextInput like given_name, family_name and so on. The problem is when I try to modify the populated data from any TextInput it won't allow me as the text will not change at all and remain fixed as what it is no matter what. I am aware this is happening because the value of my fields are assigned to the incoming data that I want to update but how do I fix that and be able to modify this value ?
I would appreciate if you can help.
constructor(props) {
super(props);
this.state = {
given_name: '',
family_name: '',
email: '',
password: '',
UserInfo: '',
};
}
handleGivenName = (text) => {
this.setState({
given_name: text
})
}
handleLastName = (text) => {
this.setState({
family_name: text
})
}
handleEmail = (text) => {
this.setState({
email: text
})
}
handlePass = (text) => {
this.setState({
password: text
})
}
<TextInput placeholder="Last Name"
onChangeText={ this.handleLastName }
value={ this.state.UserInfo.family_name } />
<TextInput />component code looks like?<TextInput placeholder="Last Name" onChangeText={this.handleLastName} value = {this.state.UserInfo.family_name} />TextInputlooks like?TextInputcomponent is defined. Not your custom instance. See:TextInput.js