react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

How to disable ViewPager at ends so that screen gesture can take over?

Open Aryk opened this issue 3 years ago • 5 comments

I'm using react-navigation with the fullScreenSwipeEnabled option which allows to swipe back on the entire screen in iOS.

It's great except on the ViewPager, even when it's at the end it steals the touch and won't let the full-screen back to work.

Is there anyway to disable the viewpager at the ends where it has no more pages so that that the screen-back takes over?

It would essentially be like as if you have the pager nested inside another horizontal scrolling container and want it to give up the touch events when it reaches it's end.

I've played with onMoveShouldSetResponderCapture and onStartShouldSetResponder setting them to false and doesn't work.

It does work when the swipeEnabled is set to false but need to figure out when to temporarily disable it. Has anyone figured out which callbacks to hook into to determine if we can temporarily disable the pager swiping.

Aryk avatar Dec 25 '21 07:12 Aryk

+1

rkritskiy avatar Apr 06 '22 21:04 rkritskiy

@Aryk hi, did you manage to solve this problem?

rkritskiy avatar Apr 06 '22 21:04 rkritskiy

@rkritskiy did you find any alternative?

raymondjacobson avatar Apr 09 '22 22:04 raymondjacobson

@rkritskiy No I have not, I just have to live with it right now...but would love to find a solution to it...would make for a better user experience. I've tried using a state, but not smooth enough...it really has to be handled on the native level.

Aryk avatar Apr 09 '22 22:04 Aryk

I thought this was relevant, but didn't manage to get it working

https://github.com/callstack/react-native-pager-view/pull/500

raymondjacobson avatar Apr 10 '22 00:04 raymondjacobson