Open nitinelegant opened 4 months ago
same issue
Complete Solution (making a component is must) Quick guide to use @twotalltotems/react-native-otp-input for OTP Screen ,
*** first install these libraray "@twotalltotems/react-native-otp-input": "^1.3.11", "@react-native-clipboard/clipboard": "1.14.1", also check ( "react-native": "0.74.3",)
*** make a component ( must) `import React from 'react'; import { StyleSheet, View } from 'react-native'; import OTPInputView from '@twotalltotems/react-native-otp-input';
interface OTPInputComponentProps { pinCount: number; code: string; onCodeChanged: (code: string) => void; }
const OTPInputComponent: React.FC
); };
const styles = StyleSheet.create({ container: { width: '100%', padding: 10, }, inputBox: { height: 50, }, codeInputFieldStyle: { borderWidth: 1, borderColor: '#000', }, codeInputHighlightStyle: { borderColor: '#03DAC6', }, });
export default OTPInputComponent;
In your Otp screen
import React, { useState } from 'react';
import { View, Text, Button } from 'react-native';
import OTPInputComponent from './OTPInputComponent'; // Ensure the path is correct
const OTPScreen: React.FC = () => {
const [otpCode, setOtpCode] = useState
const handleCodeChanged = (newCode: string) => { setOtpCode(newCode); };
return (
); };
export default OTPScreen; `
@nitinelegant , if you are using expo: https://github.com/tttstudios/react-native-otp-input/issues/231#issuecomment-2323238450
I'm running on react-native 0.76.1
, what I've done is to use react-native-clipboard/clipboard
instead of react-native-community/clipboard
as its depreacted
After that i applied the patch on the linke below working fine.
I've struggled to fix this within two days and finally I've got this working
I hope this wll help [https://github.com/tttstudios/react-native-otp-input/pull/233] [https://github.com/tttstudios/react-native-otp-input/issues/232]
Describe the bug I have upgraded react native from version 0.72.12 to 0.74.1 after that it is throwing the below error runtime error TypeError: Cannot read property 'getString' of null
version installed @twotalltotems/react-native-otp-input": "^1.3.11"
To Reproduce Steps to reproduce the behavior: