diff --git a/src/components/CustomDialpad.tsx b/src/components/CustomDialpad.tsx index 86d9dee..35d105a 100644 --- a/src/components/CustomDialpad.tsx +++ b/src/components/CustomDialpad.tsx @@ -27,6 +27,9 @@ const CustomDialpad: FC = props => { if (item === "X") { setCode((prev) => prev.slice(0, -1)); } else { + if (code.length === pinLength) { + return; + } setCode((prev) => [...prev, item]); } } @@ -37,11 +40,11 @@ const CustomDialpad: FC = props => { Create PIN Enter your secure six-digit code - + - + )}; diff --git a/src/components/DialpadKeypad.tsx b/src/components/DialpadKeypad.tsx index de6abf9..ec37ccd 100644 --- a/src/components/DialpadKeypad.tsx +++ b/src/components/DialpadKeypad.tsx @@ -4,7 +4,6 @@ import Icon from 'react-native-vector-icons/Feather'; type DialpadKeypadProps = { dialPadContent: any[]; - pinLength: number; dialPadSize: number; dialPadTextSize: number; code: number[]; @@ -12,7 +11,7 @@ type DialpadKeypadProps = { }; const DialpadKeypad: FC = props => { - const {dialPadContent, pinLength, dialPadSize, dialPadTextSize, code, updateCodeFunc} = props; + const {dialPadContent, dialPadSize, dialPadTextSize, code, updateCodeFunc} = props; return ( index.toString()} renderItem={({ item }) => { diff --git a/src/components/DialpadPin.tsx b/src/components/DialpadPin.tsx index 5f79057..10005e1 100644 --- a/src/components/DialpadPin.tsx +++ b/src/components/DialpadPin.tsx @@ -1,6 +1,5 @@ -import {FC } from "react"; -import { StyleSheet, Text, View, FlatList, TouchableOpacity } from "react-native"; -import Icon from 'react-native-vector-icons/Feather'; +import {FC, useEffect, useRef } from "react"; +import { StyleSheet, View, Animated } from "react-native"; type DialpadPinProps = { pinSize: number; @@ -11,6 +10,27 @@ type DialpadPinProps = { const DialpadPin: FC = props => { const {dialPadContent, pinLength, code, pinSize} = props; + const animatedValue = useRef(new Animated.Value(0)).current; + + const animatedStyle = { + transform: [ + { + scale: animatedValue.interpolate({ + inputRange: [0, 3], + outputRange: [1, 1.3], + extrapolate: "clamp", + }), + }, + ], + }; + + useEffect(() => { + Animated.timing(animatedValue, { + toValue: code.length, + duration: 300, + useNativeDriver: true, + }).start(); + }, [code]); return ( @@ -18,8 +38,7 @@ const DialpadPin: FC = props => { .fill(undefined) .map((_, index) => { const item = dialPadContent[index]; - const isSelected = - typeof item === "number" && code[index] !== undefined; + const isSelected = typeof item === "number" && code[index] !== undefined; return ( = props => { styles.pinContentContainer, ]} > - {isSelected && ( - - )} + {isSelected && ( + )} ); diff --git a/src/components/steps/InitializationScreen.tsx b/src/components/steps/InitializationScreen.tsx index 74f314f..b1800b7 100644 --- a/src/components/steps/InitializationScreen.tsx +++ b/src/components/steps/InitializationScreen.tsx @@ -26,7 +26,7 @@ const InitializationScreen: FC = props => { return ( - {}} onNextFunc={() => {}}> + {}} onNextFunc={(code: string | undefined) => {console.log(code)}}> { step == PinSteps.InsertPin && Insert pin