-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
131 lines (124 loc) · 4.42 KB
/
App.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
127
128
129
130
131
import * as React from 'react';
import { Text, View, StatusBar, TouchableOpacity } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import Home from './components/Home';
import NewDeck from './components/NewDeck';
import AddCard from './components/AddCard';
import TakeQuiz from './components/TakeQuiz';
import Constants from 'expo-constants';
import Deck from './components/Deck';
import QuizResults from './components/QuizResults';
import { createStackNavigator } from '@react-navigation/stack';
import {
useFonts,
Play_400Regular,
Play_700Bold,
} from '@expo-google-fonts/play';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import decks from './reducers';
import middleware from './middleware';
import { setLocalNotification } from './utils/api';
const store = createStore(decks, middleware);
console.log(store.getState());
const Tab = createBottomTabNavigator();
const Stack = createStackNavigator();
function CustomStatusBar({ backgroundColor, ...props }) {
return (
<View style={{ backgroundColor, height: Constants.statusBarHeight }}>
<StatusBar
translucent
backgroundColor={backgroundColor}
{...props}
/>
</View>
);
}
function Dashboard() {
/* font */
let [fontsLoaded, error] = useFonts({
Play_400Regular,
});
return (
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
if (route.name === 'Home') {
return (
<Ionicons
name={focused ? 'home' : 'home-outline'}
size={size}
color={color}
/>
);
} else if (route.name === 'Add Deck') {
return (
<Ionicons
name={
focused
? 'add-circle'
: 'add-circle-outline'
}
size={size}
color={color}
/>
);
}
},
})}
tabBarOptions={{
activeTintColor: '#E63946',
inactiveTintColor: '#1D3557',
}}
>
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="Add Deck" component={NewDeck} />
</Tab.Navigator>
);
}
export default class App extends React.Component {
componentDidMount() {
setLocalNotification();
}
render() {
return (
<Provider store={store}>
<NavigationContainer>
<CustomStatusBar
backgroundColor={'#8d99ae'}
barStyle="light-content"
/>
<Stack.Navigator>
<Stack.Screen
name="Dashboard"
options={{ headerShown: false }}
component={Dashboard}
/>
<Stack.Screen
name="Deck"
options={{ headerShown: false }}
component={Deck}
/>
<Stack.Screen
name="AddCard"
options={{ headerShown: false }}
component={AddCard}
/>
<Stack.Screen
name="TakeQuiz"
options={{ headerShown: false }}
component={TakeQuiz}
/>
<Stack.Screen
name="QuizResults"
options={{ headerShown: false }}
component={QuizResults}
/>
</Stack.Navigator>
</NavigationContainer>
</Provider>
);
}
}