From 0bde919194a3eb62097791ce674132344d977061 Mon Sep 17 00:00:00 2001 From: Ksenia Lebedeva Date: Thu, 12 Sep 2024 18:09:58 +0200 Subject: [PATCH] added repeat pin --- src/components/steps/InitializationScreen.tsx | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/components/steps/InitializationScreen.tsx b/src/components/steps/InitializationScreen.tsx index bfdc364..1829c75 100644 --- a/src/components/steps/InitializationScreen.tsx +++ b/src/components/steps/InitializationScreen.tsx @@ -2,6 +2,11 @@ import {FC, useState } from "react"; import { StyleSheet, Text, TextInput, View } from "react-native"; import Button from "../Button"; +enum PinSteps { + InsertPin, + RepeatPin +} + type InitializationScreenProps = { onPressFunc: (pin: string) => void; }; @@ -9,16 +14,30 @@ type InitializationScreenProps = { const InitializationScreen: FC = props => { const {onPressFunc} = props; const [pin, onChangePin] = useState(''); + const [btnDisabled, setBtnDisabled] = useState(true); + const [step, setStep] = useState(PinSteps.InsertPin); + + const checkPin = (p: string) => { + pin === p ? setBtnDisabled(false) : setBtnDisabled(true); + } return ( + { step == PinSteps.InsertPin && - Insert pin - - + Insert pin + + + } + + { step == PinSteps.RepeatPin && - + Repeat pin + {checkPin(val)}} keyboardType="number-pad" maxLength={6}/> + + + } )};