从短信验证代码错误-本机响应

时间:2020-01-31 15:00:33

标签: javascript ios reactjs react-native

我有文字输入

<TextInput
            value={''}
            ref={ref => {
              this.refPassword = ref;
            }}
            onChangeText={value => this.handleChange(value)}
            textContentType="oneTimeCode"
            onKeyPress={this.handleKeyPress}
            keyboardType={'number-pad'}
            style={[
              styles.textInput,
              {
                left: selectedIndex * wp('15%'),
                opacity: hideInput ? 0 : 1,
              },
            ]}
          />

handleChange(value) {
this.setState(
  state => {
    return {
      value: (state.value + value).slice(0, CODE_LENGTH.length),
    };
  },
  () => {
    if (this.state.value.length >= CODE_LENGTH.length) {
      this.completePassword();
    }
  },
);

}

但是,我从短信接收到的代码不正确。

短信中的代码:113498

代码自动填充:111113

我在做什么错了?

0 个答案:

没有答案