1
1
import * as React from 'react' ;
2
2
import { createNativeStackNavigator } from '@react-navigation/native-stack' ;
3
+ import { useConnectionContext } from '../providers/ConnectionProvider' ;
4
+ import { Splash } from '../components/Splash' ;
5
+ import { SCREEN_NAMES } from './screenNames' ;
6
+
7
+ // Screen Imports
3
8
import OnBoardingHome from '../screens/Onboarding/OnBoardingHome' ;
4
9
import CreateWallet from '../screens/Onboarding/CreateWallet' ;
5
- import { SCREEN_NAMES } from './screenNames' ; // Ensure this import is correct
6
10
import ConfirmSeed from '../screens/Onboarding/ConfirmSeed' ;
7
11
import PinSetup from '../screens/Onboarding/PinSetup' ;
8
12
import ConfirmPin from '../screens/Onboarding/ConfirmPin' ;
9
13
import Dashboard from '../screens/Home/Dashboard' ;
10
- import { useConnectionContext } from '../providers/ConnectionProvider' ;
11
- import { Splash } from '../components/Splash' ;
12
14
import VerifyPin from '../screens/Home/VerifyPin' ;
13
- import Dashboard from '../screens/Home/Dashboard' ;
14
- import { useConnectionContext } from '../providers/ConnectionProvider' ;
15
- import { Splash } from '../components/Splash' ;
16
- import VerifyPin from '../screens/Home/VerifyPin' ;
17
- import ZKPoolEnter from '../navigation/ZKPoolEnter' ; // New screen for ZK pool entry
18
- import ZKPoolExit from '../navigation/ZKPoolExit' ; // New screen for ZK pool exit
15
+ import ZKPoolEnter from './ZKPoolEnter' ; // Adjusted path if needed
16
+ import ZKPoolExit from './ZKPoolExit' ; // Adjusted path if needed
19
17
20
18
export type RootStackParamList = {
21
19
OnboardingHome : undefined ;
@@ -25,78 +23,68 @@ export type RootStackParamList = {
25
23
ConfirmPin : { words : string [ ] ; walletPin : number [ ] } ;
26
24
Dashboard : undefined ;
27
25
VerifyPin : undefined ;
28
- ZKPoolEnter : undefined ; // New route for entering ZK pool
29
- ZKPoolExit : undefined ; // New route for exiting ZK pool
26
+ ZKPoolEnter : undefined ;
27
+ ZKPoolExit : undefined ;
30
28
} ;
31
29
32
30
const Stack = createNativeStackNavigator < RootStackParamList > ( ) ;
33
31
34
- function OnBoardingNavigation ( ) {
32
+ const OnBoardingNavigation = ( ) => {
35
33
const { loading, isWalletConnected } = useConnectionContext ( ) ;
36
-
34
+
37
35
if ( loading ) {
38
36
return < Splash /> ;
39
37
}
40
38
41
39
return (
42
- < Stack . Navigator >
40
+ < Stack . Navigator screenOptions = { { headerShown : false } } >
41
+ { /* Authenticated User Flow */ }
43
42
{ isWalletConnected ? (
44
43
< Stack . Group >
45
- { /* Verify Pin and Dashboard for authenticated users */ }
46
44
< Stack . Screen
47
- options = { { headerShown : false } }
48
45
name = { SCREEN_NAMES . VerifyPin }
49
46
component = { VerifyPin }
50
47
/>
51
48
< Stack . Screen
52
- options = { { headerShown : false } }
53
49
name = { SCREEN_NAMES . Dashboard }
54
50
component = { Dashboard }
55
51
/>
52
+ < Stack . Screen
53
+ name = { SCREEN_NAMES . ZKPoolEnter }
54
+ component = { ZKPoolEnter }
55
+ />
56
+ < Stack . Screen
57
+ name = { SCREEN_NAMES . ZKPoolExit }
58
+ component = { ZKPoolExit }
59
+ />
56
60
</ Stack . Group >
57
61
) : (
62
+ /* Onboarding Flow for New Users */
58
63
< Stack . Group >
59
- { /* Onboarding screens for users without a wallet */ }
60
64
< Stack . Screen
61
- options = { { headerShown : false } }
62
65
name = { SCREEN_NAMES . OnboardingHome }
63
66
component = { OnBoardingHome }
64
67
/>
65
68
< Stack . Screen
66
- options = { { headerShown : false } }
67
69
name = { SCREEN_NAMES . CreateWallet }
68
70
component = { CreateWallet }
69
71
/>
70
72
< Stack . Screen
71
- options = { { headerShown : false } }
72
73
name = { SCREEN_NAMES . ConfirmSeed }
73
74
component = { ConfirmSeed }
74
75
/>
75
76
< Stack . Screen
76
- options = { { headerShown : false } }
77
77
name = { SCREEN_NAMES . PinSetup }
78
78
component = { PinSetup }
79
79
/>
80
80
< Stack . Screen
81
- options = { { headerShown : false } }
82
81
name = { SCREEN_NAMES . ConfirmPin }
83
82
component = { ConfirmPin }
84
83
/>
85
84
</ Stack . Group >
86
85
) }
87
- { /* ZK Pool Entry and Exit Screens, common to both authenticated and unauthenticated users */ }
88
- < Stack . Screen
89
- options = { { headerShown : false } }
90
- name = { SCREEN_NAMES . ZKPoolEnter }
91
- component = { ZKPoolEnter }
92
- />
93
- < Stack . Screen
94
- options = { { headerShown : false } }
95
- name = { SCREEN_NAMES . ZKPoolExit }
96
- component = { ZKPoolExit }
97
- />
98
86
</ Stack . Navigator >
99
87
) ;
100
- }
88
+ } ;
101
89
102
90
export default OnBoardingNavigation ;
0 commit comments