0

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

radikft
  • 37
  • 2
  • 7
  • You have error in your structure.. Theoretically header nav/bar should never go inside a scroll. The scroll should be below the header bar. For prevent just add `refreshing=false` as prop inside your scroll. – jose920405 Feb 05 '18 at 20:08
  • Solved mine using [this](https://stackoverflow.com/a/52288741/2006730) – Maybelle Pacate Sep 12 '18 at 06:32

2 Answers2

3

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.

Convict Moody
  • 781
  • 1
  • 9
  • 28
  • alwaysBounceVertical is for a completely different purpose , – Milad Apr 25 '18 at 04:56
  • @Milad I am not sure how you are helpful by asking some questions without providing any details on how to fix them. – Convict Moody Apr 25 '18 at 15:19
  • I didn't ask a question man, I just said what I had read from the docs, alwaysBounceVertical is for when you scroll to the end of the view and then when you reach the end , it does a little bounce , it has nothing to do with pulling or refreshing ! – Milad Apr 25 '18 at 23:20
  • @Milad yes and that's what's happening in this case if you are looking at the image above in the OP, over scrolling with alwaysBounceVertical enabled will pull all views in the scrollviews down or up depending on the direction over scrolling is happening. – Convict Moody Apr 27 '18 at 09:27
0

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

king
  • 31
  • 4