Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 17248

How to get the text from iOS AutoFill keyboard function in React Native?

$
0
0

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}     />);

Viewing all articles
Browse latest Browse all 17248


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>