PanResponder only fires if I initiate interaction by pressing a button

#1

For whatever reason PanResponder onMoveShouldSetPanResponder will not fire on its own. It will ONLY fire if I start the PanResponder by tapping an unrelated button in the view.

The panHandlers are setup on the container:

<AnimatedView {...panHandlers}>
   <SomeButton onPress={onPress} />
</AnimatedView>

If I try and swipe outside SomeButton and inside AnimatedView, nothing happens.

If I press SomeButton, do not release, swipe into AnimatedView, onMoveShouldSetPanResponder fires

Has anyone dealt with this before? Any idea of what I can be doing wrong?

Thanks again!

0 Likes

#2

hi peter!

do you have a snack where you can repro this?

cdc

1 Like

#3

Hey Charlie!

https://snack.expo.io/ByeVKh3yM

This could just be a misunderstanding of how PanResponder works in nested Views on my part but this more or less resembles the situation I’m in right now.

Over the red box, try to swipe down and close the modal.

Then, tap and hold “Tap Me” in the bottom right corner and then swipe.

Thanks so much!

0 Likes