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

Fix: Resolve gesture detection issues in Panel5 with latest react-native-gesture-handler #84

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

alexmdefrancisco
Copy link
Contributor

Summary

This pull request addresses the (NOBRIDGE) ERROR in react-native-gesture-handler where the GestureDetector in Panel5 fails to detect gestures due to view flattening. By wrapping the child components with <View collapsable={false}>, we ensure the views remain in the hierarchy and gesture handling works as intended.

Problem

After upgrading to the latest version of react-native-gesture-handler, the GestureDetector in Panel5 stopped working correctly. Specifically:

  • Observed Error: (NOBRIDGE) ERROR [react-native-gesture-handler] GestureDetector has received a child that may get view-flattened. To prevent it from misbehaving you need to wrap the child with a <View collapsable={false}> . [Component Stack].
  • Behavior Before: This issue did not occur in earlier versions of react-native-gesture-handler, suggesting a recent change in gesture handling behavior.
  • Environment: React Native 0.76.3, react-native-gesture-handler 2.21.2.

Solution

The fix wraps the relevant child components in <View collapsable={false}>, ensuring that gesture detection functions correctly without view flattening. This change aligns with React Native's guidelines for preventing view flattening in gesture components.

Testing

  • Environment: Tested on React Native 0.76.3 with the latest version of react-native-gesture-handler.
  • Confirmed that the error no longer occurs, and gestures in Panel5 now function as expected.

Notes

  • This fix resolves the issue without introducing breaking changes. Other components and functionalities remain unaffected.
  • It is recommended to document this change in case similar issues arise with future versions of react-native-gesture-handler.

This commit resolves the (NOBRIDGE) ERROR from react-native-gesture-handler where GestureDetector cannot handle flattened views. By wrapping the affected child component in a <View  collapsable={false}>, we ensure it remains in the view hierarchy, allowing gestures to function correctly.

Tested on 0.76.3 and confirmed that the issue no longer persists.
@alabsi91
Copy link
Owner

Hey @alexmdefrancisco Is this error specific to iOS, Android, or both? Also, does the Panel5 example produce the same error? I tested the example code using latest version on an Android emulator and did not encounter any errors.

@alexmdefrancisco
Copy link
Contributor Author

Yes sorry I forgot. It happens to me using iOS, either simulator and with real device.

@alabsi91 alabsi91 merged commit aa8197a into alabsi91:main Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants