-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
146 lines (138 loc) · 3.81 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import React from 'react';
import { StyleSheet, View, Platform, StatusBar } from 'react-native';
import { TabNavigator, StackNavigator } from 'react-navigation';
import AddDeckView from './components/AddDeckView.js';
import DeckListView from './components/DeckListView.js';
import SingleDeck from './components/SingleDeck.js';
import TakeQuiz from './components/TakeQuiz.js';
import AddQuiz from './components/AddQuiz.js';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import reducer from './reducers';
import thunk from 'redux-thunk';
import { white, green } from './utils/colors';
import { setLocalNotification } from './utils/notif';
import { FontAwesome, Ionicons } from '@expo/vector-icons';
import { Constants } from 'expo';
/**
* @description - Creates global store object
*/
const store = createStore(reducer, applyMiddleware(thunk));
/**
* @description - Status bar component wrapper with styles
* @component
*/
function LocalStatusBar () {
return (
<View style={{ backgroundColor:green, height: Constants.statusBarHeight }}>
<StatusBar translucent backgroundColor={green} barStyle={'light-content'} />
</View>
);
}
/**
* @description - Tab navigation object
* @description - Contains "deckListView" & "AddDeckView"
*/
const Tabs = TabNavigator({
DeckListView: {
screen: DeckListView,
navigationOptions: {
tabBarLabel: 'Deck List',
tabBarIcon: ({ tintColor }) => <Ionicons name='ios-bookmarks' size={30} color={tintColor} />
},
},
AddDeckView: {
screen: AddDeckView,
navigationOptions: {
tabBarLabel: 'Add Deck',
tabBarIcon: ({ tintColor }) => <FontAwesome name='plus-square' size={30} color={tintColor} />
},
}
}, {
navigationOptions: {
header: null
},
tabBarOptions: {
activeTintColor: Platform.OS === 'ios' ? green : white,
style: {
height: 56,
backgroundColor: Platform.OS === 'ios' ? white : green,
shadowColor: 'rgba(0, 0, 0, 0.24)',
shadowOffset: {
width: 0,
height: 3
},
shadowRadius: 6,
shadowOpacity: 1
}
}
});
/**
* @description - Main navigation object: StackNavigator
* @description - Contains "TabNavigator", "SingleDeck", "AddQuiz" & "TakeQuiz"
*/
const MainNavigator = StackNavigator({
Home: {
screen: Tabs,
},
SingleDeck: {
screen: SingleDeck,
navigationOptions: {
headerTintColor: white,
headerStyle: {
backgroundColor: green,
}
}
},
AddQuiz: {
screen: AddQuiz,
navigationOptions: {
headerTintColor: white,
headerStyle: {
backgroundColor: green,
}
}
},
TakeQuiz:{
screen: TakeQuiz,
navigationOptions: {
headerTintColor: white,
headerStyle: {
backgroundColor: green,
}
}
}
});
export default class App extends React.Component {
/**
* @description - Ask & set local Notifications
* @lifeCycle
* @returns null
*/
componentDidMount = () =>
setLocalNotification('App.js')
/**
* @description - Renderer for this component
* @description - Carries HTML
* @lifeCycle
* @returns html template
*/
render() {
return (
<Provider store={store}>
<View style={styles.container} >
<LocalStatusBar backgroundColor={green} barStyle="light-content"></LocalStatusBar>
<MainNavigator/>
</View>
</Provider>
);
}
}
/**
* @description - Style object
*/
const styles = StyleSheet.create({
container: {
flex: 1,
},
});