ttdung11t2 / react-native-confirmation-code-input

A react-native component to input confirmation code for both Android and IOS
MIT License
411 stars 349 forks source link

issue: code.split is not a function. (In 'code.split("")','code.split' is undefined) #102

Open KrushnaNaghate opened 2 years ago

KrushnaNaghate commented 2 years ago

<OTPInputView style={{ width: '100%', height: 50, alignSelf: 'center', marginBottom: 20, }} pinCount={6} code={(this.state.code)} //You can supply this prop or not. The component will be used as a controlled / uncontrolled component respectively. onCodeChanged = {code =>{ if (code.length === 6) { { this.setState({code},()=>{ console.log('codeotp',this.state.code); })}}}} autoFocusOnLoad={false} keyboardType="number-pad" codeInputFieldStyle={{ width: 32, height: 45, borderWidth: 2, alignSelf: 'center', borderRadius: 5, color: color.secondarycolor, }} codeInputHighlightStyle={{ borderColor: color.secondarycolor,

            }}
            onCodeFilled={code => {

Screenshot_2022-08-02-19-32-18-81_c11b992e6582eb7cde7f603a58deef46

              console.log(`Code is ${code}, you are good to go!`);
            }}
            // placeholderTextColor={{color:color.primarycolor}}
          />``

I'm getting this, issue when I want to pass default value to otp , I need to add default value for getting autofill otp by hash code sms

retyui commented 2 years ago

@KrushnaNaghate

You can use a fork without this problem and with better maintainability

https://github.com/retyui/react-native-confirmation-code-field