-
Notifications
You must be signed in to change notification settings - Fork 33
/
ModalWithNavigator.js
60 lines (51 loc) · 1.3 KB
/
ModalWithNavigator.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
'use strict';
var React = require('react-native');
var {
View,
Text,
NavigatorIOS,
NativeModules,
} = React;
var SimpleList = require('./SimpleList');
var SimpleView = require('./SimpleView');
var ModalWithNavigatorCoordinator = NativeModules.ModalWithNavigatorCoordinator;
var data = [
'One',
'Two',
'Three',
]
class ModalWithNavigator extends React.Component{
_handleButton() {
ModalWithNavigatorCoordinator.closeModal();
}
_handleRowPress() {
this.refs.navigator.push({
title: 'Simple View',
component: SimpleView,
});
}
render() {
return (
<NavigatorIOS
ref="navigator"
style={styles.container}
initialRoute={{
title: 'Modal with Navigator',
component: SimpleList,
passProps: {
data: data,
rowPressed: this._handleRowPress.bind(this)
},
leftButtonTitle: 'Close',
onLeftButtonPress: this._handleButton.bind(this),
}}
/>
);
}
};
var styles = React.StyleSheet.create({
container: {
flex: 1,
}
});
module.exports = ModalWithNavigator;