Browse Source

Video 9: Add the Total Remaining Item Count to the Footer with React Native Text.

Frederic G. MARAND 7 years ago
parent
commit
e045a984e5
2 changed files with 3 additions and 0 deletions
  1. 1 0
      app.js
  2. 2 0
      footer.js

+ 1 - 0
app.js

@@ -144,6 +144,7 @@ class App extends Component {
           />
         </View>
         <Footer
+          count={filterItems("ACTIVE", this.state.items).length}
           filter={this.state.filter}
           onFilter={this.handleFilter}
         />

+ 2 - 0
footer.js

@@ -32,6 +32,7 @@ class Footer extends Component {
     const { filter } = this.props;
     return (
       <View style={styles.container}>
+        <Text>{this.props.count} count</Text>
         <View style={styles.filters}>
           <TouchableOpacity
             onPress={() => this.props.onFilter('ALL')}
@@ -55,6 +56,7 @@ class Footer extends Component {
 }
 
 Footer.propTypes = {
+  count: React.PropTypes.number,
   filter: React.PropTypes.string,
   onFilter: React.PropTypes.func
 };