This repository was archived by the owner on Feb 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
75 lines (62 loc) · 2.1 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
import 'react-native-gesture-handler';
import { DefaultTheme, Provider as PaperProvider } from 'react-native-paper';
import { NavigationContainer, Route } from '@react-navigation/native';
import AboutNavigation from "./AboutNavigation";
import AwesomeIcon from 'react-native-vector-icons/FontAwesome5';
import MainNavigation from "./MainNavigation";
import React from 'react';
import { Provider as ReduxProvider } from 'react-redux';
import STRINGS from "./strings";
import { StatusBar } from 'expo-status-bar';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import store from './redux/store';
import useAppState from './hooks/useAppState';
const Tab = createBottomTabNavigator();
const theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: 'teal',
},
};
export default function App() {
const appState = useAppState();
console.log("State changed: ", { appState })
return (
<ReduxProvider store={store}>
<PaperProvider theme={theme}
settings={{
icon: props => <AwesomeIcon {...props} />,
}}>
<StatusBar style="dark" />
<NavigationContainer>
<Tab.Navigator screenOptions={({ route }) => ({
tabBarIcon: (props) => <Icon {...props} route={route} />
})}
tabBarOptions={{
activeTintColor: 'blue',
inactiveTintColor: 'gray',
}}>
<Tab.Screen name="Home" component={MainNavigation} options={{ title: STRINGS.HOME_TAB }} />
<Tab.Screen name="About" component={AboutNavigation} options={{ title: STRINGS.INFO_TAB }} />
</Tab.Navigator>
</NavigationContainer>
</PaperProvider>
</ReduxProvider>
);
}
interface IconProps {
route: Route<string, object | undefined>,
focused: boolean;
color: string;
size: number;
}
function Icon(props: IconProps): JSX.Element {
let iconName = '';
if (props.route.name === 'Home') {
iconName = 'home';
} else if (props.route.name === 'About') {
iconName = 'info';
}
return <AwesomeIcon name={iconName} size={props.size} color={props.color} />;
}