Search code examples
react-nativetextinput

Cannot update the value in Text input


I cannot update the existing value in text input.

<TextField
              label='Email Id'
              //placeholder={value_email}
              onChangeText={(email) => this.setState({ email })}
              value={value_email}
            />

here value_email is

const value_email = this.state.userInfo.email;

Thanks.


Solution

  • this.setState({ email } Sets the email to state object (this.state.email) but you are reading it from state.userInfo.

    If you are setting it to state variable you need to change to const value_email = this.state.email;