-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
93 lines (88 loc) · 3.43 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
import { StatusBar } from 'expo-status-bar';
import { View } from 'react-native';
import DeckList from "./components/DeckList";
import AddDeck from "./components/AddDeck";
import DeckInfo from "./components/DeckInfo";
import AddCard from "./components/AddCard";
import Quiz from "./components/Quiz";
import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk";
import { Provider } from "react-redux";
import reducer from './reducers/index';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import Constants from 'expo-constants';
import { Ionicons, FontAwesome } from '@expo/vector-icons';
function FlashcardStatusBar({ backgroundColor, ...props }) {
return (
<View style={{ backgroundColor, height: Constants.statusBarHeight }}>
<StatusBar translucent backgroundColor={backgroundColor} {...props} />
</View>
);
}
const Tab = createBottomTabNavigator();
function Home() {
return (
<Tab.Navigator
screenOptions={{
headerShown: false,
tabBarActiveTintColor: '#0052D4',
tabBarInactiveTintColor: 'gray'
}}
>
<Tab.Screen name="Decks" component={DeckList} options={{
tabBarLabel: 'Decks',
tabBarIcon: ({ color, size }) => (
<Ionicons name="md-bookmarks" size={size} color={color} />
),
tabBarBadge: 3,
}} />
<Tab.Screen name="AddDeck" component={AddDeck} options={{
tabBarLabel: 'Add Deck',
tabBarIcon: ({ color, size }) => (
<FontAwesome name="plus-square" size={size} color={color} />
),
}} />
</Tab.Navigator>
);
}
const Stack = createNativeStackNavigator();
export default function App() {
return (
<Provider store={createStore(reducer, applyMiddleware(thunk))}>
<FlashcardStatusBar backgroundColor={"#00BCD4"} barStyle="dark-content" />
<NavigationContainer>
<Stack.Navigator initialRouteName="Home" screenOptions={{
headerStyle: {
backgroundColor: '#00BCD4',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
}}>
<Stack.Screen
name="Home"
component={Home}
options={{ headerShown: false }}
/>
<Stack.Screen name="DeckInfo" component={DeckInfo} options={{
title: 'Deck Detail'
}} />
<Stack.Screen name="AddCard" component={AddCard} options={{
title: 'Add Card'
}} />
<Stack.Screen name="Quiz" component={Quiz} options={
({ route }) => {
const { title } = route.params;
return {
title: `${title} Quiz`
}
}
} />
</Stack.Navigator>
</NavigationContainer>
</Provider>
);
}