-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
82 lines (72 loc) · 2.37 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
// React imports
import React from 'react';
// React Navigation imports
import {
NavigationContainer,
DefaultTheme,
DarkTheme,
} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
// Contexts
import {DarkModeProvider, useDarkMode} from './DarkModeContext';
// Type definitions
import {RootStackParamList} from './Types';
// Screens
import MainScreen from './Navigation/MainScreen';
import FormScreen from './Navigation/Screens/FormScreen';
import ListScreen from './Navigation/Screens/ListScreen';
import RepositoryScreen from './Navigation/Screens/RepositoryScreen';
import TagScreen from './Navigation/Screens/TagScreen';
import TagDetails from './Navigation/Screens/TagDetails';
// External libraries
import {RootSiblingParent} from 'react-native-root-siblings';
import {MobileAds} from 'react-native-google-mobile-ads';
const Stack = createStackNavigator<RootStackParamList>();
function StackNavigator(): JSX.Element {
MobileAds().initialize();
const {isDarkMode} = useDarkMode();
const theme = isDarkMode ? DarkTheme : DefaultTheme;
return (
<DarkModeProvider>
<NavigationContainer theme={theme}>
<Stack.Navigator
screenOptions={{
headerStyle: {
backgroundColor: isDarkMode ? '#333' : '#fff',
},
headerTintColor: isDarkMode ? '#fff' : '#000',
cardStyle: {
backgroundColor: isDarkMode ? '#333' : '#fff',
},
}}>
<Stack.Screen name="RegistryPort" component={MainScreen} />
<Stack.Screen name="Add" component={FormScreen} />
<Stack.Screen name="List" component={ListScreen} />
<Stack.Screen
name="RepositoryScreen"
component={RepositoryScreen}
options={({route}) => ({title: route.params.serviceName})}
/>
<Stack.Screen
name="TagScreen"
component={TagScreen}
options={({route}) => ({
title: route.params.repo,
})}
/>
<Stack.Screen name="TagDetails" component={TagDetails} />
</Stack.Navigator>
</NavigationContainer>
</DarkModeProvider>
);
}
function App(): JSX.Element {
return (
<RootSiblingParent>
<DarkModeProvider>
<StackNavigator />
</DarkModeProvider>
</RootSiblingParent>
);
}
export default App;