-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp_ReduxWithnavigation.js
136 lines (115 loc) · 3.5 KB
/
App_ReduxWithnavigation.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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
// import React, {Component} from 'react';
// import {Platform, StyleSheet, Text, View} from 'react-native';
// const instructions = Platform.select({
// ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
// android:
// 'Double tap R on your keyboard to reload,\n' +
// 'Shake or press menu button for dev menu',
// });
// export default class App extends Component {
// render() {
// return (
// <View style={styles.container}>
// <Text style={styles.welcome}>Welcome to React Native!</Text>
// <Text style={styles.instructions}>To get started, edit App.js</Text>
// <Text style={styles.instructions}>{instructions}</Text>
// </View>
// );
// }
// }
import React, { Component } from 'react';
import { createStackNavigator, createAppContainer, createBottomTabNavigator } from 'react-navigation';
import Friends from './screens/friendsScreen';
import First from './screens/firstScreen';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import rootReducer from './redux/reducer/index';
import HomeScreen from './screens/homeScreen';
import DetailsScreen from './screens/detailsScreen';
import SettingsScreen from './screens/settingsScreen';
// import { Ionicons } from '@expo/vector-icons';
const store = createStore(rootReducer);
const HomeStack = createStackNavigator({
Home: { screen: HomeScreen },
Details: { screen: DetailsScreen },
});
const SettingsStack = createStackNavigator({
Settings: { screen: SettingsScreen },
Details: { screen: DetailsScreen },
});
const AppContainer = createAppContainer(createBottomTabNavigator(
{
Home: { screen: HomeStack },
Settings: { screen: SettingsStack },
},
{
// defaultNavigationOptions: ({ navigation }) => ({
// tabBarIcon: ({ focused, tintColor }) => {
// const { routeName } = navigation.state;
// let iconName;
// if (routeName === 'Home') {
// iconName = `ios-information-circle${focused ? '' : '-outline'}`;
// } else if (routeName === 'Settings') {
// iconName = `ios-options${focused ? '' : '-outline'}`;
// }
// // You can return any component that you like here! We usually use an
// // icon component from react-native-vector-icons
// return <view></view>;
// },
// }),
tabBarOptions: {
activeTintColor: 'tomato',
inactiveTintColor: 'gray',
},
}
));
// const AppNavigator = createStackNavigator({
// Home: First,
// Friends: Friends
// },
// {
// initialRouteName: "Home"
// });
//const AppContainer = createAppContainer(AppNavigator);
export default class App extends Component {
// constructor(props) {
// super(props)
// this.state = {
// possibleFriends: [
// 'Allie',
// 'Gator',
// 'Lizzie',
// ],
// currentFriends: [],
// }
// }
// addFriend = (index) => {
// const {
// currentFriends,
// possibleFriends,
// } = this.state
// // Pull friend out of possibleFriends
// const addedFriend = possibleFriends.splice(index, 1)
// // And put friend in currentFriends
// currentFriends.push(addedFriend)
// // Finally, update our app state
// this.setState({
// currentFriends,
// possibleFriends,
// })
// }
render() {
return (
<Provider store={store}>
<AppContainer/>
</Provider>
);
}
}