-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavigation.js
44 lines (40 loc) · 932 Bytes
/
navigation.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
import React, { Component } from 'react';
import { Navigator,
BackAndroid
} from 'react-native';
import { Members } from './members';
import { Member } from './member';
var _navigator;
export var addAndroidBackSupport = () => {
BackAndroid.addEventListener('hardwareBackPress', () => {
if (_navigator.getCurrentRoutes().length === 1) {
return false;
}
_navigator.pop();
return true;
});
}
export class Navigation extends Component {
render() {
return(
<Navigator
ref={(nav) => {_navigator=nav; }}
initialRoute={{member: null}}
renderScene={this._renderScene}
/>
)
}
_renderScene(route, navigator) {
if (route.member === null) {
return <Members
onSelect={(member) => {
navigator.push({ member: member })
}}
/>
} else {
return <Member
member={route.member}
/>
}
}
}