mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-01 06:22:39 +08:00
ForceMountToView when Opacity or other View-specific properties are applied to a FlatShadowNode
Summary: @public There are some properties, such as alpha or scale that we ONLY handle on a View level. This means that whenever we encounter a FlatShadowNode with this property, it should be mapped to a View. This diff is doing exactly this. Reviewed By: ahmedre Differential Revision: D2694495
This commit is contained in:
committed by
Ahmed El-Helw
parent
0d042c2ef4
commit
1da7049426
@@ -11,6 +11,7 @@ package com.facebook.react.flat;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.ReactProp;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
@@ -23,6 +24,15 @@ import com.facebook.react.uimanager.ViewProps;
|
||||
|
||||
/* package */ static final FlatShadowNode[] EMPTY_ARRAY = new FlatShadowNode[0];
|
||||
|
||||
private static final String PROP_DECOMPOSED_MATRIX = "decomposedMatrix";
|
||||
private static final String PROP_OPACITY = "opacity";
|
||||
private static final String PROP_RENDER_TO_HARDWARE_TEXTURE = "renderToHardwareTextureAndroid";
|
||||
private static final String PROP_ACCESSIBILITY_LABEL = "accessibilityLabel";
|
||||
private static final String PROP_ACCESSIBILITY_COMPONENT_TYPE = "accessibilityComponentType";
|
||||
private static final String PROP_ACCESSIBILITY_LIVE_REGION = "accessibilityLiveRegion";
|
||||
private static final String PROP_IMPORTANT_FOR_ACCESSIBILITY = "importantForAccessibility";
|
||||
private static final String PROP_TEST_ID = "testID";
|
||||
|
||||
private DrawCommand[] mDrawCommands = DrawCommand.EMPTY_ARRAY;
|
||||
private AttachDetachListener[] mAttachDetachListeners = AttachDetachListener.EMPTY_ARRAY;
|
||||
private NodeRegion[] mNodeRegions = NodeRegion.EMPTY_ARRAY;
|
||||
@@ -37,6 +47,22 @@ import com.facebook.react.uimanager.ViewProps;
|
||||
private boolean mBackingViewIsCreated;
|
||||
private @Nullable DrawBackgroundColor mDrawBackground;
|
||||
|
||||
/* package */ void handleUpdateProperties(CatalystStylesDiffMap styles) {
|
||||
if (!mountsToView()) {
|
||||
// Make sure we mount this FlatShadowNode to a View if any of these properties are present.
|
||||
if (styles.hasKey(PROP_DECOMPOSED_MATRIX) ||
|
||||
styles.hasKey(PROP_OPACITY) ||
|
||||
styles.hasKey(PROP_RENDER_TO_HARDWARE_TEXTURE) ||
|
||||
styles.hasKey(PROP_TEST_ID) ||
|
||||
styles.hasKey(PROP_ACCESSIBILITY_LABEL) ||
|
||||
styles.hasKey(PROP_ACCESSIBILITY_COMPONENT_TYPE) ||
|
||||
styles.hasKey(PROP_ACCESSIBILITY_LIVE_REGION) ||
|
||||
styles.hasKey(PROP_IMPORTANT_FOR_ACCESSIBILITY)) {
|
||||
forceMountToView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects DrawCommands produced by this FlatShadoNode.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user