react-native: panResponder doesn't work with Modal
Description
onMoveShouldSetPanResponder
is not triggered inside the Modal
component, when used outside is triggered just fine.
Reproduction Steps and Sample Code
https://snack.expo.io/HkttB70ZZ
- Click on the
Touch me !!
green box and the alert from the event should be triggered. - Click on
Click Open Modal
to open the Modal. - Click on the
Touch me !!
green box, observe that event is not triggered anymore.
Additional Information
- React Native version: 0.44.2
- Platform: iOS
- Development Operating System: macOS
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 15
- Comments: 19
I tried @onlybenyang 's workaround and the modal now successfully releases its responder. So Im using this for now:
@FaiChou: I managed to get touches working by adding:
Any updates on this? It’s still not working.
Still trouble me.
The
handlePanResponderMove
function won’t called when 2 fingers in the screen. But it will called when single finger touch and move.I put the responder under the
Modal
.Info:
@react-native-bot @tibbus Hope you can reopen this issue until facebook team fix it or tell any useful solution.
THANKS.
same here, not working on .49
This issue should not be closed. I just ran into it myself too. Should we just recreate it?
@jrob-io your solution works for me, thanks!
For me what fixed the issue was making sure I included all of panresponder’s methods. Personally all I was missing was…
onStartShouldSetPanResponder: (evt, gestureState) => true,
and once I added that it was fixed. If you can’t get it to work try adding all of panresponder’s methods just to check that you are not missing anything.good luck!
I just had this issue, I fixed it by following these instructions https://github.com/facebook/react-native/issues/9786#issuecomment-262932857 Enjoy !