retyui / react-native-confirmation-code-field

A react-native confirmation code field compatible with iOS, Android and Web
MIT License
1.07k stars 125 forks source link

Impossible use different variable name #208

Closed iim-norse closed 2 years ago

iim-norse commented 2 years ago

TypeError: setValue is not a function. (In 'setValue(text)', 'setValue' is undefined)

Знімок екрана 2022-06-11 о 15 12 43

when I use variables different from this: const [ value, setValue ] = useState(''); for example if you try const [ value1, setValue1 ] = useState(''); get this error

retyui commented 2 years ago

I have an intelligent solution for you issue:

const [ myValue1, setMyValue1 ] = useState('');

 const ref = useBlurOnFulfill({value:myValue1, cellCount: CELL_COUNT});
  const [props, getCellOnLayoutHandler] = useClearByFocusCell({
    value: myValue1,
    setValue: setMyValue1,
  });