skip to Main Content

I’m using @twotalltotems/react-native-otp-input library for otp input, but it is giving this error.enter image description here

Here is my code :

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

I’m using the same code as given in the library readme section but not getting the issue.
This is the link of that library : https://www.npmjs.com/package/@twotalltotems/react-native-otp-input

Is there anything else that I should do to use this library like add something in build.gradle file etc.
Can someone please help me in this.
Thanks in advance.

2

Answers


  1. Chosen as BEST ANSWER

    I solved this issue by using "@react-native-community/clipboard" library along with "@twotalltotems/react-native-otp-input". So, both the libraries together solved my issue.


  2. Can you explain what you mean when you say you used @react-native-community/clipboard along with react-native-otp-input? or share a code example

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search