react-native-otp-input: TypeError: Cannot read property 'getString' of undefined
Getting the error:
TypeError: Cannot read property 'getString' of undefined
This error is located at:
in OTPInputView (at OTPScreen.js:9)
As mentioned in the pinned issue, I installed @react-native-community/clipboard, still facing the same issue. I did yarn cache clean, deleted node_modules and yarn. lock and even then didn’t work.
My package.json:
"@react-native-community/clipboard": "^1.5.1",
"@twotalltotems/react-native-otp-input": "^1.3.11",
OTPSceen component:
import React from 'react';
import { View, Text, StyleSheet, SafeAreaView } from 'react-native';
import OTPInputView from '@twotalltotems/react-native-otp-input';
const OTPScreen = () => {
return(
<View style={styles.otpContainer}>
<Text>Inside OTP Screen</Text>
<OTPInputView
style={{width: '80%', height: 200}}
pinCount={4}
codeInputFieldStyle={styles.underlineStyleBase}
codeInputHighlightStyle={styles.underlineStyleHighLighted}
onCodeFilled = {(code => {
console.log(`Code is ${code}, you are good to go!`)
})}
/>
</View>
);
};

Could you please advise, what am I missing here?
Thanks
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 22
Commits related to this issue
- #143 Use expo-clipboard for expo projects — committed to tttstudios/react-native-otp-input by deleted user 3 years ago
- #143 Use expo-clipboard for expo managed workflow — committed to tttstudios/react-native-otp-input by deleted user 3 years ago
I faced this issue and solved it by using these versions
“@twotalltotems/react-native-otp-input”: “1.3.5”, “@react-native-community/clipboard”: “^1.5.1”,
facing same issue but not work with above solution
npm install --save @react-native-community/clipboard npx react-native run-android // worked for me
if installed clipboard npm its working fine npm install --save @react-native-community/clipboard
Steps for reproducing the error:
expo init testProject(bare javascript template)yarn add @twotalltotems/react-native-otp-inputandyarn add @react-native-community/clipboardGetting the same error as shown in the screenshot above. Can you please suggest, if there is a workaround or version mismatch issue?
“@react-native-community/clipboard”: “^1.5.1”, “@twotalltotems/react-native-otp-input”: “^1.3.11”,
I also getting same error.