@@ -5,7 +5,7 @@ import { useState, useEffect } from 'react';
55import ScrollableWrapper from '../../../shared/components/ScrollableWrapper' ;
66import { StepIndicator } from '../components/StepIndicator' ;
77import { MnemonicDisplayInput } from '../components/MnemonicDisplayInput' ;
8- import PasteMnemonic from '../../../shared/utils/pasteFromClipboard ' ;
8+ import { pasteMnemonicFromClipboard } from '../../../shared/utils/clipboard ' ;
99import { NativeStackNavigationProp } from '@react-navigation/native-stack' ;
1010import { RootNavigatorTypeParamListType } from '../../../navigation/types' ;
1111import TextWithFont from '../../../shared/components/TextWithFont' ;
@@ -16,27 +16,27 @@ type ImportWalletScreenNavigationProp = NativeStackNavigationProp<
1616> ;
1717
1818type RouteParams = {
19- mnemonicLength : number | null ;
19+ mnemonicLength : number ;
2020} ;
2121
2222export default function ImportWalletScreen ( ) {
2323 const navigation = useNavigation < ImportWalletScreenNavigationProp > ( ) ;
24+
2425 const route = useRoute ( ) ;
2526 const { mnemonicLength } = route . params as RouteParams ;
26- const [ mnemonic , setMnemonic ] = useState < string [ ] > ( [ ] ) ;
27+
28+ const [ mnemonic , setMnemonic ] = useState < string [ ] > (
29+ Array . from ( { length : mnemonicLength } , ( ) => '' )
30+ ) ;
2731
2832 // Check if all fields are filled in
2933 const isAllFilled =
3034 mnemonic . length === mnemonicLength && mnemonic . every ( word => word . trim ( ) . length > 0 ) ;
3135
32- useEffect ( ( ) => {
33- console . log ( 'Mnemonic updated:' , mnemonic , 'All filled:' , isAllFilled ) ;
34- } , [ mnemonic , mnemonicLength , isAllFilled ] ) ;
35-
3636 const handleNext = async ( ) => {
37- console . log ( 'User mnemonic words' , mnemonic ) ;
3837 if ( isAllFilled ) {
3938 try {
39+ // TODO remove this
4040 const fullMnemonic = mnemonic . join ( ' ' ) ;
4141 navigation . navigate ( 'NameWalletScreen' , { mnemonic : fullMnemonic } ) ;
4242 } catch ( error ) {
@@ -48,33 +48,30 @@ export default function ImportWalletScreen() {
4848 } ;
4949
5050 const handlePaste = async ( ) => {
51- await PasteMnemonic ( { mnemonicLength, setMnemonic } ) ;
51+ await pasteMnemonicFromClipboard ( { mnemonicLength, setMnemonic } ) ;
5252 } ;
5353
5454 return (
5555 < ScrollableWrapper >
5656 < View className = "flex-col flex-1 mt-5 items-center" >
5757 < View >
58- < TextWithFont customStyle = 'text-xl md: text-2xl text-white text-center font-bold' >
58+ < TextWithFont customStyle = 'text-xl text-2xl text-white text-center font-bold' >
5959 Write your seed phrase
6060 </ TextWithFont >
61- < TextWithFont customStyle = { ` text-white text-center mt-2 text-sm md:text-lg` } >
61+ < TextWithFont customStyle = ' text-white text-center mt-2 text-sm md:text-lg' >
6262 Make sure no one can see your screen
6363 </ TextWithFont >
6464 </ View >
6565
6666 < MnemonicDisplayInput
67- mnemonicLength = { mnemonicLength }
68- onChange = { setMnemonic }
69- initialWords = { mnemonic }
67+ mnemonic = { mnemonic }
68+ setMnemonic = { setMnemonic }
7069 />
7170
72- < View className = "" >
73- < Pressable onPress = { handlePaste } className = "flex-row gap-1 items-center" >
74- < Image source = { require ( '../../../../assets/icons/copy.png' ) } />
75- < TextWithFont customStyle = "font-bold text-white" > Paste</ TextWithFont >
76- </ Pressable >
77- </ View >
71+ < Pressable onPress = { handlePaste } className = "flex-row gap-1 items-center" >
72+ < Image source = { require ( '../../../../assets/icons/copy.png' ) } />
73+ < TextWithFont customStyle = "font-bold text-white" > Paste</ TextWithFont >
74+ </ Pressable >
7875
7976 < View className = "flex-row my-5 bg-custom_border p-1 rounded-xl w-full" >
8077 < Button onPress = { ( ) => navigation . goBack ( ) } text = { 'Back' } customStyle = { 'w-1/2' } />
@@ -85,8 +82,8 @@ export default function ImportWalletScreen() {
8582 customStyle = { `bg-${ isAllFilled ? 'custom_accent' : 'white' } w-1/2` }
8683 />
8784 </ View >
88- </ View >
85+ </ View >
8986 < StepIndicator totalSteps = { 5 } currentStep = { 3 } />
90- </ ScrollableWrapper >
87+ </ ScrollableWrapper >
9188 ) ;
9289}
0 commit comments