-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
144 lines (140 loc) · 4.83 KB
/
App.tsx
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import 'react-native-gesture-handler';
import { enableScreens } from 'react-native-screens';
enableScreens();
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { DarkTheme, NavigationContainer } from '@react-navigation/native';
import { useFonts } from 'expo-font';
import WalletManager from './src/components/wallet/WalletManager';
import { createNativeStackNavigator } from 'react-native-screens/native-stack';
import AppTabs from './src/components/navigation/AppTabs';
import ProfileScreen from './src/components/screens/ProfileScreen';
import SettingsScreen from './src/components/screens/SettingsScreen';
import { PortalProvider } from '@gorhom/portal';
import FilmRollStack from './src/components/navigation/FilmRollStack';
import PhotoScreen from './src/components/screens/PhotoScreen';
import * as Sentry from 'sentry-expo';
import OnboardingStack from './src/components/navigation/OnboardingStack';
import useWallet from './src/features/useWallet';
import useOnboardingState from './src/features/useOnboardingState';
Sentry.init({
dsn: 'https://[email protected]/5864063',
enableAutoSessionTracking: true
});
export type AppStackParamsList = {
Home: undefined;
FilmRollStack: { title: string; filmAddress: string };
Profile: { walletAddress: string };
Photo: { tokenId: string };
Settings: undefined;
};
const Stack = createNativeStackNavigator<AppStackParamsList>();
export default function App() {
const linking = { prefixes: ['https://cam.internet.camera'] };
const [loaded] = useFonts({
HelveticaNowRegular: {
uri: require('./assets/fonts/HelveticaNowText-Regular.otf')
},
HelveticaNowBold: {
uri: require('./assets/fonts/HelveticaNowText-Bold.otf')
},
HelveticaNowMicroRegular: {
uri: require('./assets/fonts/HelveticaNowMicro-Regular.otf')
},
HelveticaNowMicroBold: {
uri: require('./assets/fonts/HelveticaNowMicro-Bold.otf')
},
JetBrainsMono: { uri: require('./assets/fonts/JetBrainsMono-Regular.ttf') }
});
const account = useWallet(state => state.account);
const needsOnboarding = useOnboardingState(state => state.needsOnboarding());
if (!loaded) return null;
return (
<PortalProvider>
<StatusBar style="light" />
<WalletManager />
<NavigationContainer
linking={linking}
theme={{
...DarkTheme,
colors: { ...DarkTheme.colors, primary: '#fff' }
}}
>
{!account || needsOnboarding ? (
<OnboardingStack />
) : (
<Stack.Navigator>
<Stack.Screen
name="Home"
component={AppTabs}
options={{ headerTintColor: 'white', headerShown: false }}
/>
<Stack.Screen
name="FilmRollStack"
component={FilmRollStack}
options={({ route }) => ({
title: `$${route.params?.title}` || 'Cam',
headerTitleStyle: {
color: `hsl(${
parseInt(route.params?.filmAddress.slice(-9) || '0', 16) %
360
}, 100%, 70%)`
},
headerTintColor: 'white',
headerBackTitleVisible: false,
headerStyle: {
backgroundColor: 'rgb(5,5,5)'
}
})}
/>
<Stack.Screen
name="Profile"
component={ProfileScreen}
options={{
headerTintColor: 'white',
headerBackTitleVisible: false,
title: '',
headerTitleStyle: {
fontFamily: 'HelveticaNowBold'
},
headerStyle: {
backgroundColor: 'rgb(5,5,5)'
}
}}
/>
<Stack.Screen
name="Photo"
component={PhotoScreen}
options={{
headerTintColor: 'white',
headerBackTitleVisible: false,
title: '',
headerTitleStyle: {
fontFamily: 'HelveticaNowBold'
},
headerStyle: {
backgroundColor: 'rgb(5,5,5)'
}
}}
/>
<Stack.Screen
name="Settings"
component={SettingsScreen}
options={{
title: 'Settings',
headerTintColor: 'white',
headerBackTitleVisible: false,
headerTitleStyle: {
fontFamily: 'HelveticaNowBold'
},
headerStyle: {
backgroundColor: 'rgb(5,5,5)'
}
}}
/>
</Stack.Navigator>
)}
</NavigationContainer>
</PortalProvider>
);
}