import React from 'react'; import { View, Text, TouchableOpacity, KeyboardAvoidingView, Platform, } from 'react-native'; import { getStyles } from './otpScreen.styles'; import { PrimaryButton } from '@components'; import { useAppTheme } from '@theme'; import { useOtpScreen } from './hooks/useOtpScreen'; export const OtpScreen: React.FC = () => { const { colors } = useAppTheme(); const styles = getStyles(colors); const { mobileNumber, otp, activeIndex, timer, isLoading, otpLength, isOtpComplete, handleKeyPress, handleVerify, handleResend, } = useOtpScreen(); return ( Verify OTP Code sent to {mobileNumber} {otp.map( ( digit: | string | number | bigint | boolean | React.ReactElement< unknown, string | React.JSXElementConstructor > | Iterable | React.ReactPortal | Promise< | string | number | bigint | boolean | React.ReactPortal | React.ReactElement< unknown, string | React.JSXElementConstructor > | Iterable | null | undefined > | null | undefined, index: React.Key | null | undefined, ) => ( {digit} ), )} {[1, 2, 3, 4, 5, 6, 7, 8, 9].map(num => ( handleKeyPress(String(num))} activeOpacity={0.6} > {num} ))} handleKeyPress('backspace')} activeOpacity={0.6} > handleKeyPress('0')} activeOpacity={0.6} > 0 {timer > 0 ? ( Resend code in {timer}s ) : ( Resend OTP )} ); };