瀏覽代碼

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

Frederic G. MARAND 7 年之前
父節點
當前提交
e045a984e5
共有 2 個文件被更改,包括 3 次插入0 次删除
  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
 };