mirror of
https://github.com/status-im/react-native.git
synced 2025-01-17 04:50:59 +00:00
Apply base View properties (scale, alpha etc) to FlatShadowNode when it maps to a View
Summary: @public There are some properties that we want to handle on a View level, as opposed to a FlatShadowNode level. For example, scale or alpha, that can be done very efficiently in hardware. Once we pop FlatShadowNode to a separate View, we need to apply these properties. This is where `BaseViewManager` comes in handy. Reviewed By: sriramramani Differential Revision: D2694290
This commit is contained in:
parent
dad378e394
commit
b8b4fb8a74
@ -80,7 +80,11 @@ public class FlatUIImplementation extends UIImplementation {
|
|||||||
ReactShadowNode cssNode,
|
ReactShadowNode cssNode,
|
||||||
int rootViewTag,
|
int rootViewTag,
|
||||||
CatalystStylesDiffMap styles) {
|
CatalystStylesDiffMap styles) {
|
||||||
// nothing to do yet.
|
int tag = cssNode.getReactTag();
|
||||||
|
FlatShadowNode node = (FlatShadowNode) cssNode;
|
||||||
|
if (node.mountsToView()) {
|
||||||
|
mStateBuilder.ensureBackingViewIsCreated(node, tag, styles);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -88,7 +92,11 @@ public class FlatUIImplementation extends UIImplementation {
|
|||||||
ReactShadowNode cssNode,
|
ReactShadowNode cssNode,
|
||||||
String className,
|
String className,
|
||||||
CatalystStylesDiffMap styles) {
|
CatalystStylesDiffMap styles) {
|
||||||
// nothing to do yet.
|
int tag = cssNode.getReactTag();
|
||||||
|
FlatShadowNode node = (FlatShadowNode) cssNode;
|
||||||
|
if (node.mountsToView()) {
|
||||||
|
mStateBuilder.ensureBackingViewIsCreated(node, tag, styles);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,15 +10,20 @@
|
|||||||
package com.facebook.react.flat;
|
package com.facebook.react.flat;
|
||||||
|
|
||||||
import com.facebook.react.uimanager.ThemedReactContext;
|
import com.facebook.react.uimanager.ThemedReactContext;
|
||||||
import com.facebook.react.uimanager.ViewManager;
|
import com.facebook.react.uimanager.BaseViewManager;
|
||||||
|
|
||||||
abstract class FlatViewManager<C extends FlatShadowNode> extends ViewManager<FlatViewGroup, C> {
|
abstract class FlatViewManager<C extends FlatShadowNode> extends BaseViewManager<FlatViewGroup, C> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FlatViewGroup createViewInstance(ThemedReactContext reactContext) {
|
protected FlatViewGroup createViewInstance(ThemedReactContext reactContext) {
|
||||||
return new FlatViewGroup(reactContext);
|
return new FlatViewGroup(reactContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBackgroundColor(FlatViewGroup view, int backgroundColor) {
|
||||||
|
// suppress
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateExtraData(FlatViewGroup root, Object extraData) {
|
public void updateExtraData(FlatViewGroup root, Object extraData) {
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,10 @@ import com.facebook.react.uimanager.CatalystStylesDiffMap;
|
|||||||
int tag,
|
int tag,
|
||||||
@Nullable CatalystStylesDiffMap styles) {
|
@Nullable CatalystStylesDiffMap styles) {
|
||||||
if (node.isBackingViewCreated()) {
|
if (node.isBackingViewCreated()) {
|
||||||
|
if (styles != null) {
|
||||||
|
// if the View is already created, make sure propagate new styles.
|
||||||
|
mOperationsQueue.enqueueUpdateProperties(tag, node.getViewClass(), styles);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user