<bdo id='vXijJ'></bdo><ul id='vXijJ'></ul>
<legend id='vXijJ'><style id='vXijJ'><dir id='vXijJ'><q id='vXijJ'></q></dir></style></legend>
    1. <small id='vXijJ'></small><noframes id='vXijJ'>

        <tfoot id='vXijJ'></tfoot>
        <i id='vXijJ'><tr id='vXijJ'><dt id='vXijJ'><q id='vXijJ'><span id='vXijJ'><b id='vXijJ'><form id='vXijJ'><ins id='vXijJ'></ins><ul id='vXijJ'></ul><sub id='vXijJ'></sub></form><legend id='vXijJ'></legend><bdo id='vXijJ'><pre id='vXijJ'><center id='vXijJ'></center></pre></bdo></b><th id='vXijJ'></th></span></q></dt></tr></i><div id='vXijJ'><tfoot id='vXijJ'></tfoot><dl id='vXijJ'><fieldset id='vXijJ'></fieldset></dl></div>
      1. 实现拉取刷新 FlatList

        Implement pull to refresh FlatList(实现拉取刷新 FlatList)
          <tbody id='ZQr7F'></tbody>

        <small id='ZQr7F'></small><noframes id='ZQr7F'>

          • <tfoot id='ZQr7F'></tfoot>

                <bdo id='ZQr7F'></bdo><ul id='ZQr7F'></ul>
                <i id='ZQr7F'><tr id='ZQr7F'><dt id='ZQr7F'><q id='ZQr7F'><span id='ZQr7F'><b id='ZQr7F'><form id='ZQr7F'><ins id='ZQr7F'></ins><ul id='ZQr7F'></ul><sub id='ZQr7F'></sub></form><legend id='ZQr7F'></legend><bdo id='ZQr7F'><pre id='ZQr7F'><center id='ZQr7F'></center></pre></bdo></b><th id='ZQr7F'></th></span></q></dt></tr></i><div id='ZQr7F'><tfoot id='ZQr7F'></tfoot><dl id='ZQr7F'><fieldset id='ZQr7F'></fieldset></dl></div>

                <legend id='ZQr7F'><style id='ZQr7F'><dir id='ZQr7F'><q id='ZQr7F'></q></dir></style></legend>
                1. 本文介绍了实现拉取刷新 FlatList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  请帮助我在我的应用程序上实现拉动刷新,我对本机反应有点新,谢谢.我不知道如何处理onRefresh和刷新.

                  please help me out to implement pull to refresh on my app, I'm kinda new to react native, thanks. I don't know how to handle onRefresh and refreshing.

                  class HomeScreen extends Component {
                    state = { refreshing: false }
                  
                    _renderItem = ({ item }) => <ImageGrid item={item} />
                  
                    _handleRefresh = () => {
                  
                    };
                  
                    render() {
                      const { data } = this.props;
                      if (data.loading) {
                        return (
                          <Root>
                            <Loading size="large" />
                          </Root>
                        )
                      }
                   return (
                     <Root>
                       <HomeHeader />
                       <FlatList
                         contentContainerStyle={{ alignSelf: 'stretch' }}
                         data={data.getPosts}
                         keyExtractor={item => item._id}
                         renderItem={this._renderItem}
                         numColumns={3}
                         refreshing={this.state.refreshing}
                         onRefresh={this._handleRefresh}
                       />
                     </Root>
                    );
                   }
                  }
                  
                  export default graphql(GET_POSTS_QUERY)(HomeScreen);
                  

                  推荐答案

                  设置变量

                  this.state = { 
                      isFetching: false,
                  }
                  

                  创建刷新函数

                  onRefresh() {
                      this.setState({isFetching: true,},() => {this.getApiData();});
                  }
                  

                  最后设置onRefresh并在FlatList中刷新.

                  And in last set onRefresh and refreshing in FlatList.

                  <FlatList
                      data={ this.state.FlatListItems }
                      onRefresh={() => this.onRefresh()}
                      refreshing={this.state.isFetching}
                  />
                  

                  在getApiData函数中获取数据后确保设置false isFetching.

                  After fetching Data in function getApiData Make sure to set false isFetching.

                  this.setState({ isFetching: false })
                  

                  这篇关于实现拉取刷新 FlatList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Gradient Button to background-color blinks on hover(悬停时背景颜色的渐变按钮闪烁)
                  How to make hovering over active button not use hover effect?(如何使悬停在活动按钮上不使用悬停效果?)
                  html javascript show image hover(html javascript 显示图像悬停)
                  How to get css hover values on click?(如何在点击时获得 css 悬停值?)
                  Change background image on link hover(更改链接悬停时的背景图像)
                  Highlight multiple items on hover#39;s condition(突出显示悬停条件下的多个项目)
                    <bdo id='EFu16'></bdo><ul id='EFu16'></ul>

                    <tfoot id='EFu16'></tfoot>
                            <legend id='EFu16'><style id='EFu16'><dir id='EFu16'><q id='EFu16'></q></dir></style></legend>
                          • <small id='EFu16'></small><noframes id='EFu16'>

                              <tbody id='EFu16'></tbody>
                          • <i id='EFu16'><tr id='EFu16'><dt id='EFu16'><q id='EFu16'><span id='EFu16'><b id='EFu16'><form id='EFu16'><ins id='EFu16'></ins><ul id='EFu16'></ul><sub id='EFu16'></sub></form><legend id='EFu16'></legend><bdo id='EFu16'><pre id='EFu16'><center id='EFu16'></center></pre></bdo></b><th id='EFu16'></th></span></q></dt></tr></i><div id='EFu16'><tfoot id='EFu16'></tfoot><dl id='EFu16'><fieldset id='EFu16'></fieldset></dl></div>