diff --git a/src/Main.tsx b/src/Main.tsx index 1917859..3cf99fc 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -19,10 +19,10 @@ const Main = () => { const isDarkMode = useColorScheme() === 'dark'; const [isModalVisible, setIsModalVisible] = useState(false); const [step, setStep] = useState(Step.Discovery); - const [pin, setPin] = useState(null || String); const didMount = useRef(false); const stepRef = useRef(step); + const pinRef = useRef(""); const keycardConnectHandler = async () => { try { @@ -41,7 +41,7 @@ const Main = () => { } break; case Step.Initialization: - await Keycard.init(pin); + await Keycard.init(pinRef.current); setStep(Step.Loading); break; case Step.Loading: @@ -55,8 +55,8 @@ const Main = () => { break; } - if (pin) { - await Keycard.unpair(pin); + if (pinRef.current) { + await Keycard.unpair(pinRef.current); } } catch (err) { console.log(err); @@ -94,7 +94,7 @@ const Main = () => { } const initPin = async (p: string) => { - setPin(p); + pinRef.current = p; return connectCard(); } diff --git a/src/components/steps/InitializationScreen.tsx b/src/components/steps/InitializationScreen.tsx index d857a8d..bfdc364 100644 --- a/src/components/steps/InitializationScreen.tsx +++ b/src/components/steps/InitializationScreen.tsx @@ -1,5 +1,5 @@ -import {FC } from "react"; -import { StyleSheet, Text, View } from "react-native"; +import {FC, useState } from "react"; +import { StyleSheet, Text, TextInput, View } from "react-native"; import Button from "../Button"; type InitializationScreenProps = { @@ -8,12 +8,14 @@ type InitializationScreenProps = { const InitializationScreen: FC = props => { const {onPressFunc} = props; + const [pin, onChangePin] = useState(''); return ( - Hello world - + Insert pin + + diff --git a/src/components/steps/LoadingScreen.tsx b/src/components/steps/LoadingScreen.tsx new file mode 100644 index 0000000..7a96e92 --- /dev/null +++ b/src/components/steps/LoadingScreen.tsx @@ -0,0 +1,30 @@ +import {FC } from "react"; +import { StyleSheet, Text, View } from "react-native"; +import Button from "../Button"; + +type LoadingScreenProps = { + onPressFunc: () => void; +}; + +const LoadingScreen: FC = props => { + const {onPressFunc} = props; + + return ( + + + Load mnemonic + + + + + + )}; + +const styles = StyleSheet.create({ + heading: { + textAlign: 'center', + fontSize: 16 + } +}); + +export default LoadingScreen; \ No newline at end of file