-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
98 lines (90 loc) · 2.98 KB
/
App.tsx
File metadata and controls
98 lines (90 loc) · 2.98 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
87
88
89
90
91
92
93
94
95
96
97
98
import 'react-native-gesture-handler';
import React, { useEffect } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { useDarkMode, getTabBarIcon } from './src/utils';
import * as RNLocalize from 'react-native-localize';
import { setI18nConfig, translate } from './src/Translations/TranslationModel';
import { colors } from './src/Model/Model';
import { PreferencesProvider } from './src/Model/Preferences';
import { StatisticseProvider } from './src/Model/Statistics';
import RandomStack from './src/Navigation/RandomStack';
import ResourcesStack from './src/Navigation/ResourcesStack';
import AdvancedStack from './src/Navigation/AdvancedStack';
import MoreStack from './src/Navigation/MoreStack';
const Tab = createBottomTabNavigator();
setI18nConfig();
/**
* @function App
* @description The main component for the App.
* Created 10/10/20
* @returns {JSX.Element} JSX render instructions.
*
* @copyright 2025 Alexander Burdiss
* @author Alexander Burdiss
* @since 2/1/25
* @version 1.0.2
*
* @example
* <App />
*/
export default function App() {
const DARKMODE = useDarkMode();
useEffect(() => {
RNLocalize.addEventListener('change', handleLocalizationChange);
return () => {
RNLocalize.removeEventListener('change', handleLocalizationChange);
};
}, []);
const handleLocalizationChange = () => {
setI18nConfig();
this.forceUpdate();
};
return (
<StatisticseProvider>
<PreferencesProvider>
<NavigationContainer>
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: getTabBarIcon(route),
tabBarActiveTintColor: DARKMODE
? colors.purpleDark
: colors.purpleLight,
tabBarInactiveTintColor: colors.systemGray,
tabBarStyle: {
backgroundColor: DARKMODE
? colors.systemGray6Dark
: colors.white,
borderTopColor: DARKMODE
? colors.systemGray5Dark
: colors.systemGray5Light,
},
headerShown: false,
})}
>
<Tab.Screen
name="RandomStack"
component={RandomStack}
options={{ title: translate('Random') }}
/>
<Tab.Screen
name="ResourcesStack"
component={ResourcesStack}
options={{ title: translate('Resources') }}
/>
<Tab.Screen
name="AdvancedStack"
component={AdvancedStack}
options={{ title: translate('Advanced') }}
/>
<Tab.Screen
name="MoreStack"
component={MoreStack}
options={{ title: translate('Settings') }}
/>
</Tab.Navigator>
</NavigationContainer>
</PreferencesProvider>
</StatisticseProvider>
);
}