Skip to content

Commit 2274917

Browse files
committed
added react navigation
1 parent 25425fd commit 2274917

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed

Diff for: App.js

+39-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,56 @@
11
import React from 'react'
2-
import {View} from 'react-native'
2+
import {View, Platform} from 'react-native'
3+
import {createAppContainer, createBottomTabNavigator} from 'react-navigation'
34
import {Provider} from 'react-redux'
45
import {createStore} from 'redux'
6+
import {FontAwesome, Ionicons} from '@expo/vector-icons'
57

68
import AddEntry from './components/AddEntry'
9+
import {purple, white} from "./utils/colors"
10+
import History from "./components/History"
711
import reducer from './reducers'
8-
import History from "./components/History";
912

1013
const store = createStore(reducer);
14+
const Tabs = createBottomTabNavigator({
15+
History: {
16+
screen: History,
17+
navigationOptions: {
18+
tabBarLevel: 'History',
19+
tabBarIcon: ({tintColor}) => <Ionicons name='ios-bookmarks' size={30} color={tintColor}/>
20+
}
21+
},
22+
AddEntry: {
23+
screen: AddEntry,
24+
navigationOptions: {
25+
tabBarLevel: 'Add Entry',
26+
tabBarIcon: ({tintColor}) => <FontAwesome name='plus-square' size={30} color={tintColor}/>
27+
}
28+
}
29+
}, {
30+
tabBarOptions: {
31+
activeTintColor: Platform.OS === 'ios' ? purple : white,
32+
style: {
33+
height: 56,
34+
backgroundColor: Platform.OS === 'ios' ? white : purple,
35+
shadowColor: 'rgba(0, 0, 0, 0.24)',
36+
shadowOffset: {
37+
width: 0,
38+
height: 3
39+
},
40+
shadowRadius: 6,
41+
shadowOpacity: 1,
42+
}
43+
}
44+
});
45+
const Container = createAppContainer(Tabs);
1146

1247
export default class App extends React.Component {
1348
render() {
1449
return (
1550
<Provider store={store}>
1651
<View style={{flex: 1}}>
17-
<View style={{height: 20}}/>
18-
<History/>
52+
<View style={{height: 20}}/>
53+
<Container/>
1954
</View>
2055
</Provider>
2156
);

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"expo": "^31.0.2",
1919
"react": "16.5.0",
2020
"react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",
21-
"react-navigation": "^2.18.2",
21+
"react-navigation": "^3.0.0",
2222
"react-redux": "^5.1.1",
2323
"redux": "^4.0.1",
2424
"udacifitness-calendar": "^11.0.0"

0 commit comments

Comments
 (0)