Fix the pointerEvents prop on SafeAreaProvider (fixes #432 #130)#464
Open
cboar wants to merge 1 commit intoAppAndFlow:mainfrom
Open
Fix the pointerEvents prop on SafeAreaProvider (fixes #432 #130)#464cboar wants to merge 1 commit intoAppAndFlow:mainfrom
pointerEvents prop on SafeAreaProvider (fixes #432 #130)#464cboar wants to merge 1 commit intoAppAndFlow:mainfrom
Conversation
pointerEvents prop on SafeAreaProvider (fixes #432)pointerEvents prop on SafeAreaProvider (fixes #432 #130)
|
What's the process for getting this merged? Just hit this inconsistency in behavior between iOS and Android, and it's sad to see the fix has been available for almost two years. |
Collaborator
|
@janicduplessis is this ok to merge? |
Collaborator
|
Sorry about taking forever to get to this, I wonder if that is something that would be better fixed in RN core. Pointer events should be part of the props that are inherited from View, and it does work on iOS. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes #432 / #130, where the
pointerEventsprop has no effect when applied to theSafeAreaProvider. I share the same use-case as the creator of the issue: I wish to use aSafeAreaProvideras part of an overlay, where touch events should be passed to views underneath it, as is expected when settingpointerEvents="box-none".It seems the behavior described was working until the library was migrated to the new architecture. Here are my findings:
RNCSafeAreaProviderManagerDelegate#setPropertymethod. This method will invoke the appropriate@ReactPropsetter method defined in its corresponding ViewManager.setPropertymethod does not include a case to handle a prop, it will not be passed to the ViewManager. Note that react-native does provide cases for mostViewprops with the BaseViewManagerInterface. However,pointerEventsis not included.pointerEventsprop to theNativePropsspecs definition. Unfortunately, because the definition requires a specific format to pass codegen, it also clashes with the inheritedViewProps. I add a@ts-ignorecomment as a workaround.SafeAreaProviderManagerto inherit fromReactViewManagerto handle the newly defined prop.Test Plan
As a test, I modified the example app by styling a
SafeAreaProviderwithStyleSheet.absoluteFill, and placing a Touchable button underneath/behind the view. When addingpointerEvents="none"to theSafeAreaProvider, the button can be pressed with this fix. Without this fix, the button cannot be pressed.