-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
126 lines (114 loc) · 4.56 KB
/
index.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
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
import 'react-native-url-polyfill/auto';
import { useFonts } from 'expo-font';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { lightTheme, darkTheme } from './constants/themes';
import { registerRootComponent } from 'expo';
import { SettingsProvider, useDarkMode } from './contexts/SettingsContext';
import * as SplashScreen from 'expo-splash-screen';
import { useCallback } from 'react';
import messaging from '@react-native-firebase/messaging';
import { Platform, PermissionsAndroid } from 'react-native';
import HomeTabs from './HomeTabs';
import Announcement from './screens/home/AnnouncementScreen';
import Event from './screens/home/EventScreen';
import PastEvents from './screens/home/PastEventsScreen';
import ClubsList from './screens/community/ClubsListScreen';
import ClubStatus from './screens/community/ClubStatusScreen';
import ClubFunding from './screens/community/ClubFundingScreen';
import ClubPromotion from './screens/community/ClubPromotionScreen';
import TechTeam from './screens/community/TechTeamScreen';
import Volunteering from './screens/community/VolunteeringScreen';
import YouthCommittees from './screens/community/YouthCommitteesScreen';
import StudyResources from './screens/resources/StudyResourcesScreen';
import PostSecondary from './screens/resources/PostSecondaryScreen';
import FAQ from './screens/resources/FAQScreen';
import StudentServices from './screens/resources/StudentServicesScreen';
SplashScreen.preventAutoHideAsync();
// Request notification permissions
if (Platform.OS === 'ios') {
messaging().requestPermission();
} else if (Platform.OS === 'android') {
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
}
const Stack = createNativeStackNavigator();
const App = () => {
const { darkMode } = useDarkMode();
const theme = darkMode ? darkTheme : lightTheme;
// Load fonts
const [fontsLoaded] = useFonts({
GeneralSansBold: require('./assets/fonts/GeneralSans-Bold.otf'),
GeneralSansBoldItalic: require('./assets/fonts/GeneralSans-BoldItalic.otf'),
GeneralSansSemiBold: require('./assets/fonts/GeneralSans-Semibold.otf'),
GeneralSansSemiBoldItalic: require('./assets/fonts/GeneralSans-SemiboldItalic.otf'),
GeneralSansMedium: require('./assets/fonts/GeneralSans-Medium.otf'),
GeneralSansMediumItalic: require('./assets/fonts/GeneralSans-MediumItalic.otf'),
GeneralSansRegular: require('./assets/fonts/GeneralSans-Regular.otf'),
GeneralSansItalic: require('./assets/fonts/GeneralSans-Italic.otf'),
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
// Screen options
const options = {
webViewScreen: {
headerShown: true,
headerTintColor: theme.colors.onPrimary,
headerTitleAlign: 'center',
},
};
return (
<NavigationContainer theme={theme} onReady={onLayoutRootView}>
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen name="Home Tabs" component={HomeTabs} />
<Stack.Screen name="Announcement" component={Announcement} />
<Stack.Screen name="Event" component={Event} />
<Stack.Screen name="Past Events" component={PastEvents} />
<Stack.Screen name="Clubs List" component={ClubsList} />
<Stack.Screen name="Club Status" component={ClubStatus} />
<Stack.Screen
name="Club Funding"
component={ClubFunding}
options={options.webViewScreen}
/>
<Stack.Screen
name="Club Promotion"
component={ClubPromotion}
options={options.webViewScreen}
/>
<Stack.Screen name="Tech Team" component={TechTeam} />
<Stack.Screen name="Volunteering" component={Volunteering} />
<Stack.Screen name="Youth Committees" component={YouthCommittees} />
<Stack.Screen name="Study Resources" component={StudyResources} />
<Stack.Screen
name="Post-Secondary"
component={PostSecondary}
options={options.webViewScreen}
/>
<Stack.Screen name="FAQ" component={FAQ} />
<Stack.Screen
name="Student Services"
component={StudentServices}
options={options.webViewScreen}
/>
</Stack.Navigator>
</NavigationContainer>
);
};
const AppWrapper = () => {
return (
<SettingsProvider>
<App />
</SettingsProvider>
);
};
registerRootComponent(AppWrapper);