Skip to content
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

[iOS] Gestures don't work on child transformed out of the parent bounds when it originally fit inside them #6832

Open
j-piasecki opened this issue Dec 18, 2024 · 2 comments
Labels
Maintainer issue Issue created by a maintainer

Comments

@j-piasecki
Copy link
Member

j-piasecki commented Dec 18, 2024

Description

Reanimated not committing non-layout changes to the shadow tree may break gestures on components outside parents (among other things). Here: https://github.com/facebook/react-native/blob/b8f3f919cc9ebbd086d9ac79c93fffd532c55b09/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm#L620 the insets wouldn't be updated since layout will be skipped.

Content from the original RNGH issue:

Description

When gesture detector is attached to a view A which has a child B which may be transformed, if the child starts fully inside the bounds of its parent, the gestures will not work on the child when it's moved outside the bounds. When the child doesn't fit inside the parent's bounds, the gesture will work on it when moved further away.

Child fits fully inside parent's bounds:

Screen.Recording.2024-12-18.at.13.37.00.mov

Child extends out of the parent's bounds

Screen.Recording.2024-12-18.at.13.37.18.mov

Steps to reproduce

See the videos, Reanimated used in repro: 3.16.1

Snack or a link to a repository

https://gist.github.com/j-piasecki/102a4d821059ae2bb4313207425d09f1

Gesture Handler version

2.20.2

React Native version

0.76.5

Platforms

iOS

JavaScript runtime

Hermes

Workflow

Expo bare workflow

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

@j-piasecki j-piasecki added the Maintainer issue Issue created by a maintainer label Dec 18, 2024
@j-piasecki
Copy link
Member Author

I always knew Gesture Handler wouldn't do anything like this. Adding margin: isPressed.value ? 0.01 : 0, to the animated styles fixes the problem by forcing Reanimated to commit its changes to the shadow tree.

Case closed.

@j-piasecki
Copy link
Member Author

I've been informed I can transfer issues between repos 🤯

@j-piasecki j-piasecki reopened this Dec 19, 2024
@j-piasecki j-piasecki transferred this issue from software-mansion/react-native-gesture-handler Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintainer issue Issue created by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant