Browse Source

Add setTabBadge example

Guy Carmeli 8 years ago
parent
commit
cd66729398
1 changed files with 11 additions and 0 deletions
  1. 11
    0
      example-redux/src/screens/SecondTabScreen.js

+ 11
- 0
example-redux/src/screens/SecondTabScreen.js View File

@@ -45,6 +45,10 @@ class SecondTabScreen extends Component {
45 45
             <Text style={styles.button}>Select First Tab</Text>
46 46
           </TouchableOpacity>
47 47
 
48
+          <TouchableOpacity onPress={ this.onSetTabBadgePress.bind(this) }>
49
+            <Text style={styles.button}>Set Tab Badge</Text>
50
+          </TouchableOpacity>
51
+
48 52
           <Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
49 53
           <Text style={{fontWeight: '500'}}>Number prop: {this.props.num}</Text>
50 54
           <Text style={{fontWeight: '500'}}>Object prop: {this.props.obj.str}</Text>
@@ -143,6 +147,13 @@ class SecondTabScreen extends Component {
143 147
       }
144 148
     });
145 149
   }
150
+
151
+  onSetTabBadgePress() {
152
+    this.props.navigator.setTabBadge({
153
+      badge: this.props.counter.count,
154
+      tabIndex: 1
155
+    });
156
+  }
146 157
 }
147 158
 
148 159
 const styles = StyleSheet.create({