-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.js
85 lines (74 loc) · 3.16 KB
/
Main.js
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
// import { StatusBar } from 'expo-status-bar';
import { useFonts } from 'expo-font'
import { useEffect, useState, useContext } from 'react';
import { createStackNavigator } from '@react-navigation/stack';
import { NavigationContainer, DefaultTheme } from '@react-navigation/native';
import { useWalletConnect, withWalletConnect } from '@walletconnect/react-native-dapp';
// import UserWrapper from './context/UserWrapper'
import { UserProvider } from './context/UserWrapper'
import Splash from './screens/Splash'
import CryptoAuth from './screens/CryptoAuth'
import App from './screens/App'
// import Home from './screens/Home'
import Details from './screens/Details'
import Account from './screens/User/Account';
import CreateNFT from './screens/NFT/Create';
import UploadNFT from './screens/NFT/Upload';
import Collections from './screens/User/Collections';
import Verify from './screens/User/Verify';
import Settings from './screens/User/Settings';
import Favorites from './screens/User/Favorites';
const Stack = createStackNavigator();
const theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
backgrounds: "transparent"
}
}
const Main = () => {
const connector = useWalletConnect();
const [defaultRoute, setDefaultRoute] = useState("Splash");
const [loaded] = useFonts({
InterBold: require("./assets/fonts/Inter-Bold.ttf"),
InterSemiBold: require("./assets/fonts/Inter-SemiBold.ttf"),
InterMedium: require("./assets/fonts/Inter-Medium.ttf"),
InterRegular: require("./assets/fonts/Inter-Regular.ttf"),
InterLight: require("./assets/fonts/Inter-Light.ttf"),
InterRegular: require("./assets/fonts/Inter-Regular.ttf"),
});
if (!loaded) return null;
// const { currentAccount } = useContext(UserWrapper);
// console.log(currentAccount === false ? "Splash" : "App");
// console.log(connector.connected);
return (
<NavigationContainer theme={theme}>
<UserProvider>
<Stack.Navigator
screenOptions={{headerShown: false}}
initialRouteName={connector.connected === false ? "Splash" : "App"}
>
{connector.connected ? (
<>
<Stack.Screen name="App" component={App}></Stack.Screen>
<Stack.Screen name="Details" component={Details}></Stack.Screen>
<Stack.Screen name="Manage Profile" component={Account}></Stack.Screen>
<Stack.Screen name="Create NFT" component={CreateNFT}></Stack.Screen>
<Stack.Screen name="Upload NFT" component={UploadNFT}></Stack.Screen>
<Stack.Screen name="Collections" component={Collections}></Stack.Screen>
<Stack.Screen name="Favorites" component={Favorites}></Stack.Screen>
<Stack.Screen name="Verify" component={Verify}></Stack.Screen>
<Stack.Screen name="Settings" component={Settings}></Stack.Screen>
</>
) : (
<>
<Stack.Screen name="CryptoAuth" component={CryptoAuth}></Stack.Screen>
<Stack.Screen name="Splash" component={Splash}></Stack.Screen>
</>
)}
</Stack.Navigator>
</UserProvider>
</NavigationContainer>
);
}
export default Main;