react-native-modalize icon indicating copy to clipboard operation
react-native-modalize copied to clipboard

No gestures detected on Android with react-native-gesture-handler 2.x

Open giacomoarienti opened this issue 3 years ago • 23 comments

Describe the bug On Android is not possible to close the modal by swiping or tapping outside the modal.

Reproduce

  • Android emulator
  • Create a Modalize instance inside a View or SafeAreaView

Dependencies:

  • react-native-gesture-handler: ~2.1.0
  • react-native-modalize: ^2.0.13
  • react-native: 0.64.3
  • expo: ^44.0.0
  • react-navigation/native: ^6.0.2,

giacomoarienti avatar Dec 28 '21 12:12 giacomoarienti

Same problem only on android, on ios it closes when pressing outside the modal.

alexissanchezsequal avatar Jan 03 '22 23:01 alexissanchezsequal

same here

TPausL avatar Jan 09 '22 13:01 TPausL

Does anyone find a workaround for this issue so far?

petervistyan avatar Jan 10 '22 14:01 petervistyan

Does anyone find a workaround for this issue so far?

To close the modal I’ve added a cancel button that calls the close method of the modal ref

giacomoarienti avatar Jan 10 '22 14:01 giacomoarienti

Is there any news on this?

Cmoen11 avatar Jan 25 '22 08:01 Cmoen11

Hi, I haven't been able to look at it yet, but in the meantime I would recommend downgrading to RNGH v1.x.

I will eventually upgrade RNGH on my projects so I will need to fix it on Modalize. If anyone has a fix and want to open a PR before that, feel free, otherwise, please be patient, it might take a while

jeremybarbet avatar Jan 27 '22 08:01 jeremybarbet

Hi Jeremy ! thanks again for that awesome package ! Just wondering, is there a timeline for the fix ?

perroudsky avatar Feb 07 '22 15:02 perroudsky

I don't want to make false promise so I don't have any timeline. I started working on it here https://github.com/jeremybarbet/react-native-modalize/pull/227. It will be released as major with breaking changes once done

jeremybarbet avatar Feb 08 '22 21:02 jeremybarbet

ok cool, thanks for the update !

perroudsky avatar Feb 08 '22 21:02 perroudsky

I'm very interested knowing that most of my projects are using Modalize

BloodyMonkey avatar Feb 23 '22 15:02 BloodyMonkey

Hi ... I decided to port all my modals to this project, just to find out it ain't working on Android .. damn. Guess I need to revert everything until this gets fixed ..

Hopefully it's sorted soon.

edi avatar Mar 07 '22 20:03 edi

Hi @jeremybarbet I see you updated reanimated branch with REANIMATED 2 and RNGH 2, and React Native >= 0.65 Unfortunately, i'm using expo 44 (latest) who use React Native 0.64.3 What's the part of Modalize who need React Native 0.65 ?

BloodyMonkey avatar Mar 21 '22 08:03 BloodyMonkey

@BloodyMonkey you can just use https://github.com/gorhom/react-native-bottom-sheet meanwhile.

Nice keyboard support, expo supported, reanimated 2, swipe to dismiss, snap points, etc.

edi avatar Mar 21 '22 08:03 edi

@edi Thanks, I was just thinking of using it but I was still hesitating. But at this point of my project i cannot wait longer...

BloodyMonkey avatar Mar 21 '22 08:03 BloodyMonkey

@edi @jeremybarbet I found a solution. Wrapping your root view inside <GestureHandlerRootView> fix the problem and the modal is swipeable again BUT doesn't work with withReactModal SO wrapping Modalize inside a Portal works great !

BloodyMonkey avatar Mar 21 '22 12:03 BloodyMonkey

@BloodyMonkey but is the modal content scrollable on Android? My modal is swipable when I wrapped it in GestureHandlerRootView but the inner content isn't scrollable.

Also getting a warning message: Warning: Cannot record touch end without a touch start. Touch End: %s Touch Bank: %s {"identifier":0,"pageX":0,"pageY":0,"timestamp":443417329} [null,{"touchActive":true,"startPageX":164.71102905273438,"startPageY":473.07342529296875,"startTimeStamp":443417215,"currentPageX":163.62037658691406,"currentPageY":500.80157470703125,"currentTimeStamp":443417328,"previousPageX":163.62037658691406,"previousPageY":475.9500732421875,"previousTimeStamp":443417312}]

Mcebrera avatar Mar 23 '22 23:03 Mcebrera

Any update for this please ? I updated to expo 44 and it uses RNGH 2. The modal opens but we can't swipe to close it on ANDROID, it works fine on IOS.

jobberma avatar Apr 15 '22 13:04 jobberma

If anyone is still having issues with this I wrapped my root view (everything in my App.js return) in a <GestureHandlerRootView style={{ flex: 1 }}> and the modals swipe down on android AND the inner content is scrollable.

I am using RNGH v2.2 and tested it on my Samsung s10 with one ui v4.1.

Hope this helps 🙏

dylvaz avatar Apr 29 '22 09:04 dylvaz

Does anyone find a workaround? its not working on android.

abbas321 avatar May 27 '22 07:05 abbas321

@abbas321

@dylvaz solution does work !

perroudsky avatar May 27 '22 08:05 perroudsky

Describe the bug On Android is not possible to close the modal by swiping or tapping outside the modal.

Reproduce

  • Android emulator
  • Create a Modalize instance inside a View or SafeAreaView

Dependencies:

  • react-native-gesture-handler: ~2.1.0
  • react-native-modalize: ^2.0.13
  • react-native: 0.64.3
  • expo: ^44.0.0
  • react-navigation/native: ^6.0.2,

import gestureHandlerRootHOC from react-native-gesture-handler in your App.js then wrap ur App.js export with gestureHandlerRootHOC for example

import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
  
const App = () => {
    return (
       // your code to render your layout
     )
}

export default gestureHandlerRootHOC(App)

frankelly001 avatar Jun 09 '22 10:06 frankelly001

@frankelly001 Thank you so much! You're a legend!

luccameds avatar Aug 24 '22 02:08 luccameds

@frankelly001 Thank you so much! You're a legend!

You are welcome. 😎

frankelly001 avatar Aug 24 '22 09:08 frankelly001

When using with native-base: <GestureHandlerRootView style={{ flex: 1 }}> works just fine

sarnakov avatar Sep 28 '22 17:09 sarnakov

Solution: wrap your root view in <GestureHandlerRootView style={{ flex: 1 }}>

giacomoarienti avatar Sep 28 '22 19:09 giacomoarienti

Still not working for me

abeeku avatar Jan 02 '23 23:01 abeeku

@BloodyMonkey

Thanks, fixed

AmirSedaqat avatar Jan 09 '23 09:01 AmirSedaqat

Describe the bug On Android is not possible to close the modal by swiping or tapping outside the modal. Reproduce

  • Android emulator
  • Create a Modalize instance inside a View or SafeAreaView

Dependencies:

  • react-native-gesture-handler: ~2.1.0
  • react-native-modalize: ^2.0.13
  • react-native: 0.64.3
  • expo: ^44.0.0
  • react-navigation/native: ^6.0.2,

import gestureHandlerRootHOC from react-native-gesture-handler in your App.js then wrap ur App.js export with gestureHandlerRootHOC for example

import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
  
const App = () => {
    return (
       // your code to render your layout
     )
}

export default gestureHandlerRootHOC(App)

Hey, dude, this is actually working, one thing can you please help me with if I use this then it will not create an issue for another library in future ?

Thanks for your suggestion, really appreciate :)

vaibhavshah0201 avatar Aug 07 '23 05:08 vaibhavshah0201