使用@twotalltotems/react-native-otp-input遇'getString'为null错误求助
使用@twotalltotems/react-native-otp-input时遇到"cannot read property 'getString' of null"错误
错误截图:
我使用@twotalltotems/react-native-otp-input库实现OTP输入功能,完全按照库的README文档中的示例代码编写,但仍出现"cannot read property 'getString' of null"错误。
我的代码如下:
import OTPInputView from '@twotalltotems/react-native-otp-input' import React from "react"; import {StyleSheet, View, TouchableOpacity, Dimensions, KeyboardAvoidingView, Text} from "react-native"; const screenHeight = Dimensions.get('window').height export default OtpScreenComponent = () => { return ( <KeyboardAvoidingView> <View style={styles.container}> <OTPInputView style={{width: '80%', height: 200}} pinCount={6} autoFocusOnLoad codeInputFieldStyle={styles.underlineStyleBase} codeInputHighlightStyle={styles.underlineStyleHighLighted} onCodeFilled={(code => { console.log(`Code is ${code}, you are good to go!`) })} /> <TouchableOpacity onPress={() => {}}> <Text>Submit Code</Text> </TouchableOpacity> </View> </KeyboardAvoidingView> ); }
请问是否需要额外配置(如修改build.gradle文件)才能正常使用该库,恳请帮忙解答,谢谢。
内容的提问来源于stack exchange,提问作者Anjali
相关产品推荐
相关产品推荐

