Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Commit 6d9531d

Browse files
committed
migrated navigation from react-native-router-flux to new react-navigation solution
1 parent 87942e7 commit 6d9531d

File tree

6 files changed

+240
-189
lines changed

6 files changed

+240
-189
lines changed

js/app.js

+18-21
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
View,
1313
StatusBar
1414
} from 'react-native';
15-
import { Router, Scene } from 'react-native-router-flux';
15+
import { StackNavigator } from 'react-navigation';
1616
import Map from './meetups/map';
1717
import List from './meetups/list';
1818
import { createStore, combineReducers } from 'redux';
@@ -21,33 +21,30 @@ import rootReducer from './reducers/';
2121

2222
const store = createStore(rootReducer, {});
2323

24+
const Router = StackNavigator({
25+
List: { screen: List },
26+
Map: { screen: Map },
27+
},
28+
{
29+
navigationOptions: {
30+
header: {
31+
style:{
32+
backgroundColor: '#5555FF'
33+
},
34+
tintColor: 'white'
35+
}
36+
}
37+
}
38+
)
39+
2440
export class App extends Component {
2541

2642
render() {
2743
return (
2844
<Provider store={store}>
2945
<View style={{flex:1}}>
3046
<StatusBar barStyle="light-content"/>
31-
<Router>
32-
<Scene key="root">
33-
<Scene
34-
navigationBarStyle={styles.navBar}
35-
backButtonImage={require('./../assets/back_chevron.png')}
36-
titleStyle={styles.navBarText}
37-
key="map"
38-
component={Map}
39-
title="Meetup Location"
40-
/>
41-
<Scene
42-
navigationBarStyle={styles.navBar}
43-
titleStyle={styles.navBarText}
44-
key="list"
45-
component={List}
46-
title="Meetups"
47-
initial={true}
48-
/>
49-
</Scene>
50-
</Router>
47+
<Router/>
5148
</View>
5249
</Provider>
5350
);

js/meetups/list.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ import {
1818
Linking,
1919
Alert
2020
} from 'react-native';
21-
import { Actions } from 'react-native-router-flux';
2221
import moment from 'moment';
2322
import meetupApiConfig from '../../config/meetup-api'
2423
import * as eventActionCreators from '../actions/events'
2524

2625
class List extends Component {
2726

27+
static navigationOptions = {
28+
title : 'Meetups'
29+
}
30+
2831
static defaultProps = {
2932
isRefreshing: false
3033
};
@@ -41,10 +44,10 @@ class List extends Component {
4144
}
4245

4346
_pressRow(rowData) {
44-
Actions.map({
47+
this.props.navigation.navigate('Map', {
4548
longitude: rowData.venue.lon,
4649
latitude: rowData.venue.lat
47-
});
50+
})
4851
}
4952

5053
_renderRow(rowData: string, sectionID: number, rowID: number, highlightRow: (sectionID: number, rowID: number) => void) {
@@ -149,7 +152,7 @@ let styles = {
149152
justifyContent: 'flex-end',
150153
flex: 1,
151154
backgroundColor: 'white',
152-
marginTop: 63,
155+
//marginTop: 63,
153156
},
154157
title: {
155158
fontSize: 14,

js/meetups/map.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ const person = {
2121
}
2222

2323
export default class Map extends Component {
24+
25+
static navigationOptions = {
26+
title : 'Meetup Locations'
27+
}
28+
2429
render() {
25-
const latitude = this.props.latitude, longitude = this.props.longitude;
30+
const {longitude, latitude} = this.props.navigation.state.params;
2631
return (
2732
<View style={styles.container}>
2833
<MapView

jsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"allowJs": true,
4+
"allowSyntheticDefaultImports": true
5+
},
6+
"exclude": [
7+
"node_modules"
8+
]
9+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"react": "15.3.2",
1313
"react-native": "0.37.0",
1414
"react-native-maps": "^0.11.0",
15-
"react-native-router-flux": "^3.37.0",
15+
"react-navigation": "^1.0.0-beta.7",
1616
"react-redux": "^5.0.2",
1717
"redux": "^3.6.0"
1818
},

0 commit comments

Comments
 (0)