Browse Source

Update example-redux

Guy Carmeli 8 years ago
parent
commit
7ce28fd2be

+ 6
- 1
example-redux/src/screens/FirstTabScreen.js View File

21
     navigationBarColor: '#303F9F',
21
     navigationBarColor: '#303F9F',
22
     tabSelectedTextColor: '#FFA000',
22
     tabSelectedTextColor: '#FFA000',
23
     tabNormalTextColor: '#FFC107',
23
     tabNormalTextColor: '#FFC107',
24
-    tabIndicatorColor: '#FFA000'
24
+    tabIndicatorColor: '#FFA000',
25
+    drawUnderTabBar: true
25
   };
26
   };
26
 
27
 
27
   static navigatorButtons = {
28
   static navigatorButtons = {
54
         Alert.alert('NavBar', 'Add button pressed');
55
         Alert.alert('NavBar', 'Add button pressed');
55
         break;
56
         break;
56
 
57
 
58
+      case 'selectedTabChanged':
59
+        console.log('selectedTabChanged ' + event.position);
60
+        break;
61
+
57
       default:
62
       default:
58
         console.log('Unhandled event ' + event.id);
63
         console.log('Unhandled event ' + event.id);
59
         break;
64
         break;

+ 13
- 1
example-redux/src/screens/PushedScreen.js View File

12
 import * as counterActions from '../reducers/counter/actions';
12
 import * as counterActions from '../reducers/counter/actions';
13
 
13
 
14
 const leftButtons = ['back', 'cancel', 'accept', 'sideMenu'];
14
 const leftButtons = ['back', 'cancel', 'accept', 'sideMenu'];
15
+let bottomTabsVisible = true;
15
 
16
 
16
 // this is a traditional React component connected to the redux store
17
 // this is a traditional React component connected to the redux store
17
 class PushedScreen extends Component {
18
 class PushedScreen extends Component {
53
   }
54
   }
54
 
55
 
55
   onNavigatorEvent(event) {
56
   onNavigatorEvent(event) {
56
-    console.log('onNavigatorEvent ' + event.id);
57
     switch (event.id) {
57
     switch (event.id) {
58
       case 'cancel':
58
       case 'cancel':
59
         Alert.alert('NavBar', 'Cancel button pressed');
59
         Alert.alert('NavBar', 'Cancel button pressed');
109
           <Text style={styles.button}>Change Left Button</Text>
109
           <Text style={styles.button}>Change Left Button</Text>
110
         </TouchableOpacity>
110
         </TouchableOpacity>
111
 
111
 
112
+        <TouchableOpacity onPress={ this.onToggleBottomTabsPress.bind(this) }>
113
+          <Text style={styles.button}>Toggle BottomTabs</Text>
114
+        </TouchableOpacity>
115
+
112
         <TextInput style={{height: 40, borderColor: 'gray', borderWidth: 1}}/>
116
         <TextInput style={{height: 40, borderColor: 'gray', borderWidth: 1}}/>
113
 
117
 
114
         <Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
118
         <Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
206
     this.currentBackButton += 1;
210
     this.currentBackButton += 1;
207
     this.currentBackButton = this.currentBackButton % 4;
211
     this.currentBackButton = this.currentBackButton % 4;
208
   }
212
   }
213
+
214
+  onToggleBottomTabsPress() {
215
+    this.props.navigator.toggleTabs({
216
+      to: bottomTabsVisible ? 'shown' : 'hidden',
217
+      animated: true
218
+    });
219
+    bottomTabsVisible = !bottomTabsVisible;
220
+  }
209
 }
221
 }
210
 
222
 
211
 const styles = StyleSheet.create({
223
 const styles = StyleSheet.create({