-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScrollView inside swipeable modal is not working #236
Comments
Hi @quachsimon ! Thank you for reporting the issue 👍 |
@mmazzarolo removing that line fixes it for me. |
@cjroth thank you for the feedback. |
Yes I have a modal where |
@cjroth got it, at least it doesn't seem to be a bug then. Honestly, I feel like adding props for such cases is not the best pattern... but that's what we get when we try to do too many things in a single component 😁 |
I need to look at this a little closer to understand. It seems like swiping in a direction other than the |
To add a bit more context, the following check: return Math.abs(gestureState.dx) >= 4 || Math.abs(gestureState.dy) >= 4; Was added to make sure that when you press on a button inside a swipeable modal the touch won't be interpreted as a "swipe". This is probably swallowing your scrollview gesture. Following your tests, adding a prop like if (hasScrollView) {
return Math.abs(gestureState.dx) >= 4 || Math.abs(gestureState.dy) >= 4;
} should be enough to fix it, but it's also an unintuitive solution (the best way to handle it would be making the touch propagation work correctly without doing that check... but that's a different story 😀 |
I'm actually finding that it works perfectly without the A |
@cjroth 🤔 thanks for checking. |
Ahh, you are right. It does have an issue if I just remove that line. I haven't had any issues where the tap wasn't working, but rather swiping down on the modal only worked on parts of the modal that aren't touchable. What do you think of |
Hey! @cjroth has been published on |
Yep, @mmazzarolo works great, thanks for pushing this out! |
When I use |
@chohonest mind creating a small repo to reproduce the issue? |
@mmazzarolo checkout https://github.com/chohonest/MyModalProj.git and let me know if you are having the issue when you click one of the cards that open the modal and try to swipe the horizontal cards |
@chohonest yeah, it looks like the fix was not enough :/ |
@chohonest I am facing something similar to this, although I am using |
Same issue, actually I am using |
Facing the same problem. Looking for any updates. |
I've published a solution into fix-scroll. I've noticed that we don't handle horizontal scrolls. Please @german970814 @lashansam @chohonest can you test and tell me if that solves your problem ? Don't forget to that |
I've been facing this issue as well. Tried your solution @rewieer but it didn't work for me. Found a workaround for now. Hope it helps. |
Thank you this really helped, nice workaround 👍 |
it works this solution, thanks dude. |
This solution works for me! Tested in IOS, also I noticed that without the onStartShouldSetResponder={() => true} my Flatlist was only working when using 2 fingers to scroll the list inside the modal. |
WORKING SOLUTION FOR ME:
|
Thanks, it's working for me |
In my case, I was using react-native-snap-carousel and used a similar solution to @Mukhammadali
|
In my case what worked was the combinations of solutions mentioned above.Here is how it worked for me dropping this here if it's help to anyone.
This is for the swipeable modal this also worked without the TouchableOpacity if the child components had enough horizontal padding but this was what worked for me the best. |
I've no idea why, but wrapping my custom Modal component with I just exported as a memoized component: |
Thank you, it work for me |
thanks man, it works for me!, i've been trying all the above solutions here and nothing worked |
its work for me @mmazzarolo |
for me i just remove the "useNativeDriverForBackdrop" from modal and add "propagateSwipe={true}" in modal and it's work for me. |
for me, adding propagateSwipe fixed the issue |
If you're using a ScrollView or FlatList, what worked for me is changing: contentContainerStyle={{ height: "100%" }} to style={{ height: "100%" }} on the FlatList/ScrollView |
The only way i was able to get it to work was by making the renderItem return a TouchableOpacity or TouchableWithoutFeedback |
The following 3 things fixed it for me!
styles.scrollContainer is just
|
This works for me for fixing horizontal scroll problem. The crucial part in this solution is to set the |
@Mukhammadali @mguay22 |
I have FlatList with horizontal scroll as true and paging enabled so it works like a carousel, but swiping does not work in the modal. I put the renderItem View container with
|
A bit hacky, but I added an empty view below my content with marginBottom: 120 and it works on both iOS and Android.
|
Any plans to support this natively? I always end up with a flatlist inside a scroll view
|
all of these fixes break a horizontal |
Thanks , it's worked for me |
The best solution for me is still the solution from @Alexyzg
Indeed, this is the official solution given in the example of the repository : https://github.com/react-native-modal/react-native-modal/blob/master/example/src/modals/ScrollableModal.tsx Other solutions given here are deprecated or require much code for the adaptation. The purpose of the two props |
Just recently did an update and have confirmed that v7 stops the ability to scroll inside the modal whereas v6 was still working (swapped between the versions)
I looked at the diff from 6.5.0 up to 7.0.2 and the only thing I can see that may effect the scroll view would be this line.
I've tried adding the
Touchable...
around the views as other closed issues have suggested to no luck.I've been stumped on this for a couple days now and not sure what could be wrong.
The modal is something of this structure:
Any idea what changes from v6.5.0 to v7.0.2 could be causing the scrolling to not work?
The text was updated successfully, but these errors were encountered: