-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
86 lines (79 loc) · 2.42 KB
/
Copy pathApp.tsx
File metadata and controls
86 lines (79 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import {useAtom} from 'jotai';
import {selectedRpcAtom} from './components/atoms/settings';
import {ConnectionProvider} from './components/providers/ConnectionProvider';
import React, {Suspense} from 'react';
import {SafeAreaView} from 'react-native';
import {AuthorizationProvider} from './components/providers/AuthorizationProvider';
import {Header} from './components/Header';
import MainScreen from './screens/MainScreen';
import {createDrawerNavigator} from '@react-navigation/drawer';
import {NavigationContainer} from '@react-navigation/native';
import {AccountsModal} from './components/AccountsModal';
import {PoolsModal} from './components/PoolsModal';
import Loading from './components/Loading';
import PointsLoader from './components/PointsLoader';
function HomeScreen({
navigation,
rightNavigation,
}: {
navigation: any;
rightNavigation: any;
}) {
return (
<>
<Header leftNavigation={navigation} rightNavigation={rightNavigation} />
<MainScreen />
</>
);
}
const LeftDrawer = createDrawerNavigator();
const LeftDrawerScreen = ({navigation}: {navigation: any}) => {
return (
<LeftDrawer.Navigator
screenOptions={{
drawerPosition: 'left',
headerShown: false,
swipeEdgeWidth: 100,
}}
drawerContent={PoolsModal}>
<LeftDrawer.Screen name="Home">
{props => <HomeScreen {...props} rightNavigation={navigation} />}
</LeftDrawer.Screen>
</LeftDrawer.Navigator>
);
};
const RightDrawer = createDrawerNavigator();
const RightDrawerScreen = () => {
return (
<RightDrawer.Navigator
screenOptions={{
drawerPosition: 'right',
headerShown: false,
swipeEdgeWidth: 100,
}}
backBehavior="none"
drawerContent={AccountsModal}>
<RightDrawer.Screen name="HomeDrawer" component={LeftDrawerScreen} />
</RightDrawer.Navigator>
);
};
export default function App() {
const [rpc] = useAtom(selectedRpcAtom);
return (
<Suspense fallback={<Loading full />}>
<ConnectionProvider
config={{commitment: 'processed'}}
endpoint={rpc.endpoint}>
<AuthorizationProvider>
<PointsLoader>
<SafeAreaView className="h-full">
<NavigationContainer>
<RightDrawerScreen />
</NavigationContainer>
</SafeAreaView>
</PointsLoader>
</AuthorizationProvider>
</ConnectionProvider>
</Suspense>
);
}