|
@@ -10,6 +10,8 @@ import {
|
10
|
10
|
import {connect} from 'react-redux';
|
11
|
11
|
import * as counterActions from '../reducers/counter/actions';
|
12
|
12
|
|
|
13
|
+const leftButtons = ['back', 'cancel', 'accept', 'sideMenu'];
|
|
14
|
+
|
13
|
15
|
// this is a traditional React component connected to the redux store
|
14
|
16
|
class PushedScreen extends Component {
|
15
|
17
|
static navigatorStyle = {
|
|
@@ -33,6 +35,7 @@ class PushedScreen extends Component {
|
33
|
35
|
super(props);
|
34
|
36
|
this.bgColor = this.getRandomColor();
|
35
|
37
|
console.log(`constructor ${this.bgColor}`);
|
|
38
|
+ this.currentBackButton = 0;
|
36
|
39
|
}
|
37
|
40
|
|
38
|
41
|
componentWillUnmount() {
|
|
@@ -76,7 +79,6 @@ class PushedScreen extends Component {
|
76
|
79
|
<Text style={styles.button}>Dismiss modal</Text>
|
77
|
80
|
</TouchableOpacity>
|
78
|
81
|
|
79
|
|
-
|
80
|
82
|
<TouchableOpacity onPress={ this.onDismissAllModalsPress.bind(this) }>
|
81
|
83
|
<Text style={styles.button}>Dismiss all modals</Text>
|
82
|
84
|
</TouchableOpacity>
|
|
@@ -89,6 +91,10 @@ class PushedScreen extends Component {
|
89
|
91
|
<Text style={styles.button}>New Stack</Text>
|
90
|
92
|
</TouchableOpacity>
|
91
|
93
|
|
|
94
|
+ <TouchableOpacity onPress={ this.onChangeLeftButtonPress.bind(this) }>
|
|
95
|
+ <Text style={styles.button}>Change Left Button</Text>
|
|
96
|
+ </TouchableOpacity>
|
|
97
|
+
|
92
|
98
|
<TextInput style={{height: 40, borderColor: 'gray', borderWidth: 1}}/>
|
93
|
99
|
|
94
|
100
|
<Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
|
|
@@ -176,6 +182,16 @@ class PushedScreen extends Component {
|
176
|
182
|
}
|
177
|
183
|
});
|
178
|
184
|
}
|
|
185
|
+
|
|
186
|
+ onChangeLeftButtonPress() {
|
|
187
|
+ this.props.navigator.setButtons({
|
|
188
|
+ leftButton: {
|
|
189
|
+ id: leftButtons[this.currentBackButton]
|
|
190
|
+ }
|
|
191
|
+ });
|
|
192
|
+ this.currentBackButton += 1;
|
|
193
|
+ this.currentBackButton = this.currentBackButton % 4;
|
|
194
|
+ }
|
179
|
195
|
}
|
180
|
196
|
|
181
|
197
|
const styles = StyleSheet.create({
|