react-native-gesture-handler icon indicating copy to clipboard operation
react-native-gesture-handler copied to clipboard

Android Overlays with Wix React Native Navigation swallow touch events

Open gp3gp3gp3 opened this issue 3 years ago • 8 comments

Description

When using React Native Gesture Handler with Overlays in the Wix React Native Navigation library, background touch events are swallowed up by the gestureHandlerRootHOC component when positioning with flex.

In our repo we are manually moving the overlay using margin instead, and calculating that margin height has been extremely complicated while accounting for android soft heights and safe areas. Not to mention blocking using animations for the layout of the overlay container, but the HOC is required for some touch events animating inside the overlay.

Screenshots

Steps To Reproduce

  1. Open example code linked below on Android.
  2. Click header image to open overlay. See interceptTouchOutside value correctly passed to overlay option here
  3. Notice background events are not responding and the user cannot scroll
  4. Remove the gestureHandlerRootHOC from the const Overlay on line 8.
  5. Notice touch events work again.

Expected behavior

Touch events to work with overlays positioned using flex

Actual behavior

Touch events are not registering

Snack or minimal code example

https://github.com/gp3gp3gp3/rnnSandbox

Package versions

  • React: 16.13.1
  • React Native: 0.63.4
  • React Native Gesture Handler: 1.9.0
  • React Native Navigation: 7.8.4

Thanks for all the great work you do at software-mansion. I hope you can help me resolve this issue.

gp3gp3gp3 avatar Jan 26 '21 06:01 gp3gp3gp3

gestureHandlerRootHoC has a second argument for style, which is { flex: 1 } per default. You want to manually override the flex with { flex: undefined } and let the child (the page itself) render absolute sizes (height, width instead of flexbox system).

mrousavy avatar Feb 09 '21 08:02 mrousavy

@mrousavy Positioning via absolute position and margin and direct heights does not help me. I am looking to use the HOC with flex layouts, since this is supported on iOS, and positioning it similar to flex-end layout with android soft heights discrepancies per phone is not sustainable.

gp3gp3gp3 avatar Feb 09 '21 19:02 gp3gp3gp3

hi @gp3gp3gp3 any solution?

tnghia944 avatar Feb 23 '21 16:02 tnghia944

any solutions?

srfaytkn avatar Apr 27 '21 16:04 srfaytkn

@tnghia944 @srfaytkn Unfortunately no, and with the latest update to reanimated 2, this has become enough of a problem that we've decided to pull out the wix navigation library and re-write it with react-navigation. This is just one of many issues we've had trying to use Wix's navigation.

gp3gp3gp3 avatar Apr 27 '21 18:04 gp3gp3gp3

@gp3gp3gp3 it may help you, for refer there https://github.com/software-mansion/react-native-gesture-handler/pull/822/files

phuongwd avatar Aug 27 '21 09:08 phuongwd

@tnghia944 @srfaytkn Unfortunately no, and with the latest update to reanimated 2, this has become enough of a problem that we've decided to pull out the wix navigation library and re-write it with react-navigation. This is just one of many issues we've had trying to use Wix's navigation.

Im not using react navigation from wix but am encountering a similar problem with absolute positioned views. The events don't get triggered.

MANTENN avatar Dec 11 '21 22:12 MANTENN

any solutions?

erennyuksell avatar Aug 05 '23 11:08 erennyuksell