Skip to content

Commit 718f4e6

Browse files
tomasreimersfacebook-github-bot
authored andcommitted
Remove 'box-only' as a layoutOnlyProp
Summary: Currently, having the property `pointerEvents={'box-only'}` marks a view as layoutOnly. For optimization reasons, layoutOnly nodes are [not added to the node hierarchy](https://github.com/facebook/react-native/blob/b103903ec869bc48dfcaf001dc926957d0b5200a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java#L99) The problem is that should this box ever need to be [transitioned to not-layout-only](https://github.com/facebook/react-native/blob/b103903ec869bc48dfcaf001dc926957d0b5200a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java#L394) (for example, because you add the a CSS transform property), it must be added to the hierarchy. To add it to the hierarchy the [React Styles Diff Map](https://github.com/facebook/react-native/blob/b103903ec869bc48dfcaf001dc926957d0b5200a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java#L396) is passed along with the backing shadowNode to create the node. The problem is that at no point were the original `pointerEvents` and so the new node will be created with `pointerEvents = 'auto'`. A more correct fix to this problem might be to have shadowNodes carry around their pointerEvents, although this is likely a greater design decision which is why am I proposing the quick fix now. Will also resolve: react-native-modal/react-native-modal#11 Closes #15529 Reviewed By: AaaChiuuu Differential Revision: D5792012 Pulled By: tomasreimers fbshipit-source-id: 625242c53e16cb293c64811a57f6c3905b3483e0
1 parent 3ceb20d commit 718f4e6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static boolean isLayoutOnly(ReadableMap map, String prop) {
169169
return true;
170170
} else if (POINTER_EVENTS.equals(prop)) {
171171
String value = map.getString(prop);
172-
return "auto".equals(value) || "box-none".equals(value);
172+
return "auto".equals(value);
173173
} else {
174174
return false;
175175
}

0 commit comments

Comments
 (0)