|
@@ -5,7 +5,8 @@ import {
|
5
|
5
|
ScrollView,
|
6
|
6
|
TouchableOpacity,
|
7
|
7
|
StyleSheet,
|
8
|
|
- TextInput
|
|
8
|
+ TextInput,
|
|
9
|
+ Alert
|
9
|
10
|
} from 'react-native';
|
10
|
11
|
import {connect} from 'react-redux';
|
11
|
12
|
import * as counterActions from '../reducers/counter/actions';
|
|
@@ -35,6 +36,7 @@ class PushedScreen extends Component {
|
35
|
36
|
super(props);
|
36
|
37
|
this.bgColor = this.getRandomColor();
|
37
|
38
|
console.log(`constructor ${this.bgColor}`);
|
|
39
|
+ this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
|
38
|
40
|
this.currentBackButton = 0;
|
39
|
41
|
}
|
40
|
42
|
|
|
@@ -51,6 +53,19 @@ class PushedScreen extends Component {
|
51
|
53
|
return color;
|
52
|
54
|
}
|
53
|
55
|
|
|
56
|
+ onNavigatorEvent(event) {
|
|
57
|
+ console.log('onNavigatorEvent ' + event.id);
|
|
58
|
+ switch (event.id) {
|
|
59
|
+ case 'cancel':
|
|
60
|
+ Alert.alert('NavBar', 'Cancel button pressed');
|
|
61
|
+ break;
|
|
62
|
+
|
|
63
|
+ case 'accept':
|
|
64
|
+ Alert.alert('NavBar', 'Accept button pressed');
|
|
65
|
+ break;
|
|
66
|
+ }
|
|
67
|
+ }
|
|
68
|
+
|
54
|
69
|
render() {
|
55
|
70
|
return (
|
56
|
71
|
<View style={{flex: 1, padding: 20, backgroundColor: this.bgColor}}>
|