React native scrollview disable pull to refresh

六眼飞鱼酱① 提交于 2019-12-05 18:29:47

I've faced the same issue, and solved it by setting bounces property to false:

<ScrollView bounces={false} style={{ flex: 1 }}>
...
</ScrollView>

docs: https://facebook.github.io/react-native/docs/scrollview.html#bounces

use a const refreshing = false , initially. Then on call of _onRefresh , change refreshing from false to true, and reinitialise the content of the scollview.

const refreshing = false ;
const data= [];

//your class definition
_onRefresh(){
        refreshing=true;
        this.props.clearYourData();
        data= [];
        refreshing=false;
    }

render(){
  return (
    <ScrollView refreshControl={
      <RefreshControl
        refreshing={refreshing}
        onRefresh={this._onRefresh.bind(this)}
        title="Loading..."
        />
       }
      />  >
     {data}
  </ScrollView>)
}

Here what we can do is that we can Dissable the pull animation on Pull by using this .

<ScrollView
refreshing={false}
>
**YOUR RENDER ITEM**
</ScrollView>

I have never implemented this on scrollview but may be it can help you

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!