1

onChangeText is not triggered during pasting value in TextInput in IOS. How is possible to fix it? Here is my TextInput:

 <TextInput
                    value={this.state.username}
                    style={styles.input}
                    placeholder='Email'
                    placeholderTextColor='#9D9D9D'
                    returnKeyType='next'
                    selectTextOnFocus={true} 
                    onSubmitEditing={() => this.passwordRef.focus()} 
                    autoCapitalize='none'
                    autoCorrect={false}
                    autoComplete='email'
                    keyboardType='email-address'
                    onChangeText={ text => this.onChangeEmail('username', text) }
                /> 



 onChangeEmail = async (key, value) => {
        await this.setState({ [key]: value })
        const { username } = this.state
        if (username.trim() === "") {
            this.setState(() => ({ emailError: "Required"}));
            return
          }
          else if (!username.match(/.+@.+/) ){
            this.setState(() => ({ emailError: "Not an email address"}));
            return
          }
          else {
                 this.setState(() => ({ emailError: null}));
               }
    }
Lucky_girl
  • 4,543
  • 6
  • 42
  • 82

1 Answers1

1

I found the solution for this problem, instead of onChangeText, I used onChange, after that TextInput started work as expected.

Lucky_girl
  • 4,543
  • 6
  • 42
  • 82