React-native:FlatList基本使用

{
                                  return !this.state.FlatListIsLoding?
                                      {
                                              this.setState((prevState) => ({FlatListIsLoding: true}));
                                              setTimeout(()=>{
                                                  this.setState((prevState) => ({FlatListIsLoding: false}));
                                              },3000)
                                          }}
                                      >
                                          点击加载更多
                                      

                                      :  ;
                              }
                          }
                          ItemSeparatorComponent={
                              () => {
                                  return ;
                              }

                          }
                          refreshing={this.state.FlatListIsRefreshing}
                          onRefresh={()=>{
                              //刷新的方法
                              this.setState((prevState) => ({FlatListIsRefreshing: true}));
                              setTimeout(()=>{
                                  this.setState((prevState) => ({FlatListIsRefreshing: false}));
                              },3000)
                          }}
                          ListEmptyComponent={
                              
                                  空空如也
                              }
                          data={this.props.hadAddedGoods}
                          renderItem={({item}) => (
                              
                                  {item.name}

                                   {
                                      Alert.alert(
                                          '警告',
                                          '确认删除吗',
                                          [
                                              {text: '取消', onPress: () => console.log('Ask me later pressed'), style: 'cancel'},
                                              {text: '确定', onPress: () => {
                                                      this.props.deleteGoods(item);
                                                  }},
                                          ],
                                          { cancelable: false }
                                      )

                                  }}>
                                      点击删除
                                  
                              

                          )}
                >
                

 

你可能感兴趣的:(ReactNative)