radikft
radikft

Reputation: 37

Prevent pull-to-refresh for ScrollView in react-native

Is there a way to prevent pull-to-refresh functionality for ScrollView component? I want to be able scroll, but I don't wanna allow to pull down content of component and prevent situations like this:

enter image description here

Upvotes: 0

Views: 4587

Answers (2)

Convict Moody
Convict Moody

Reputation: 833

You seem like you have placed the View containing you custom made action bar inside the scroll view, and what's happening in the image you provided isn't caused by pull-to-refresh it's provided by overscrolling so you got 2 solutions:

1-Place your action bar outside your ScrollView and make the action bar and the ScrollView childrens of 1 View.

2-Add alwaysBounceVertical={false} to your ScrollView props.

Hope this helps.

Upvotes: 3

king
king

Reputation: 31

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

Upvotes: 0

Related Questions