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

Set default value? #12

Closed kbrandwijk closed 4 years ago

kbrandwijk commented 6 years ago

I have a use case for setting the value from a state variable. However, I can't find any way to do this.

appielife commented 6 years ago

Also, if you can tell a way to auto fill the input in auto fill scenarios. TY :)

vj-cubet commented 6 years ago

hi you can do by using ref

<CodeInput
      ref="codeInputRef1"
      codeLength={4}
      className={'border-b'}
      space={10}
      size={50}
      inputPosition='left'
      onFulfill={(code) => this._onFulfill(code)}
    />

 for(i=0;i<this.refs.codeInputRef1.codeInputRefs.length;i++){

        this.refs.codeInputRef1.codeInputRefs[i].setNativeProps({'text':"1")
      }
harikanammi commented 5 years ago

hi @kbrandwijk, can you resolve this issue. Please let me know how to set a input value by default. Please give me any suggestion.