mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-15 12:12:31 +08:00
Allow views to be collapsed when pointerEvents is set
Reviewed By: astreet Differential Revision: D4440164 fbshipit-source-id: 88a710affea229228f9c96b82d0bcf4c81f3205d
This commit is contained in:
committed by
Facebook Github Bot
parent
29a996c83e
commit
88eeea0995
@@ -12,6 +12,8 @@ package com.facebook.react.uimanager;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
|
||||
/**
|
||||
* Keys for props that need to be shared across multiple classes.
|
||||
*/
|
||||
@@ -64,6 +66,9 @@ public class ViewProps {
|
||||
|
||||
public static final String ASPECT_RATIO = "aspectRatio";
|
||||
|
||||
// Props that sometimes may prevent us from collapsing views
|
||||
public static final String POINTER_EVENTS = "pointerEvents";
|
||||
|
||||
// Props that affect more than just layout
|
||||
public static final String ENABLED = "enabled";
|
||||
public static final String BACKGROUND_COLOR = "backgroundColor";
|
||||
@@ -151,7 +156,14 @@ public class ViewProps {
|
||||
PADDING_TOP,
|
||||
PADDING_BOTTOM));
|
||||
|
||||
public static boolean isLayoutOnly(String prop) {
|
||||
return LAYOUT_ONLY_PROPS.contains(prop);
|
||||
public static boolean isLayoutOnly(ReadableMap map, String prop) {
|
||||
if (LAYOUT_ONLY_PROPS.contains(prop)) {
|
||||
return true;
|
||||
} else if (POINTER_EVENTS.equals(prop)) {
|
||||
String value = map.getString(prop);
|
||||
return "auto".equals(value) || "box-none".equals(value);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user