|
@@ -9,8 +9,9 @@ import {
|
9
|
9
|
} from 'react-native';
|
10
|
10
|
import {connect} from 'react-redux';
|
11
|
11
|
import * as counterActions from '../reducers/counter/actions';
|
|
12
|
+import _ from 'lodash';
|
12
|
13
|
|
13
|
|
-let navBarVisiable = true;
|
|
14
|
+let topBarVisible = true;
|
14
|
15
|
|
15
|
16
|
// this is a traditional React component connected to the redux store
|
16
|
17
|
class FirstTabScreen extends Component {
|
|
@@ -83,6 +84,10 @@ class FirstTabScreen extends Component {
|
83
|
84
|
<Text style={styles.button}>Toggle NavBar</Text>
|
84
|
85
|
</TouchableOpacity>
|
85
|
86
|
|
|
87
|
+ <TouchableOpacity onPress={ this.onSetTitlePress.bind(this) }>
|
|
88
|
+ <Text style={styles.button}>Set Title</Text>
|
|
89
|
+ </TouchableOpacity>
|
|
90
|
+
|
86
|
91
|
<Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
|
87
|
92
|
<Text style={{fontWeight: '500'}}>Number prop: {this.props.num}</Text>
|
88
|
93
|
<Text style={{fontWeight: '500'}}>Object prop: {this.props.obj.str}</Text>
|
|
@@ -134,12 +139,16 @@ class FirstTabScreen extends Component {
|
134
|
139
|
}
|
135
|
140
|
|
136
|
141
|
onToggleNavBarPress() {
|
137
|
|
- navBarVisiable = !navBarVisiable;
|
|
142
|
+ topBarVisible = !topBarVisible;
|
138
|
143
|
this.props.navigator.toggleNavBar({
|
139
|
|
- to: navBarVisiable ? 'shown' : 'hidden',
|
|
144
|
+ to: topBarVisible ? 'shown' : 'hidden',
|
140
|
145
|
animated: true
|
141
|
146
|
});
|
142
|
147
|
}
|
|
148
|
+
|
|
149
|
+ onSetTitlePress() {
|
|
150
|
+ this.props.navigator.setTitle(_.random(0, 100).toString());
|
|
151
|
+ }
|
143
|
152
|
}
|
144
|
153
|
|
145
|
154
|
const styles = StyleSheet.create({
|