th3rdwave / react-native-safe-area-context

A flexible way to handle safe area insets in JS. Also works on Android and Web!
MIT License
2.14k stars 197 forks source link

Fix the `pointerEvents` prop on SafeAreaProvider (fixes #432 #130) #464

Open cboar opened 9 months ago

cboar commented 9 months ago

Summary

This PR fixes #432 / #130, where the pointerEvents prop has no effect when applied to the SafeAreaProvider. I share the same use-case as the creator of the issue: I wish to use a SafeAreaProvider as part of an overlay, where touch events should be passed to views underneath it, as is expected when setting pointerEvents="box-none".

It seems the behavior described was working until the library was migrated to the new architecture. Here are my findings:

Test Plan

As a test, I modified the example app by styling a SafeAreaProvider with StyleSheet.absoluteFill, and placing a Touchable button underneath/behind the view. When adding pointerEvents="none" to the SafeAreaProvider, the button can be pressed with this fix. Without this fix, the button cannot be pressed.