I'm using react-native-otp-textinput
for the otp input in my app. When I use the AutoFill from iOS keyboard to paste the code, the input doesn't get filled. The library only provided solution using copy-paste method. It seems that Clipboard.getString
only return value when the text is copied.
Is there a way to retrieve the value from AutoFill for me to populate to the input?
import OTPTextInput from 'react-native-otp-textinput';const handleCellTextChange = async (text: string, i: number) => { if (i === 0) { const clippedText = await Clipboard.getString(); if (clippedText.slice(0, 1) === text) { codeRef.current?.setValue(clippedText, true); } }};return (<OTPTextInput ref={codeRef} inputCount={6} tintColor={Colour.MoodBlue} textInputStyle={styles.textCode} handleTextChange={(text: string) => setCode(text)} handleCellTextChange={handleCellTextChange} defaultValue={code} />);