mirror of
https://github.com/status-im/react-native.git
synced 2025-01-16 20:44:10 +00:00
Don't wrap unknown virtual nodes with AndroidView
Summary: Currently, we wrap all unknown shadow nodes with AndroidView. This works great, except when the shadow node is virtual, i.e. it *doesn't* mount to a View. In this case, we just need to keep it in the hierarchy as is. Fixes ARTSurfaceView not working correctly in groups. Reviewed By: ahmedre Differential Revision: D2933325
This commit is contained in:
parent
4bff818706
commit
8702a75b96
@ -79,7 +79,9 @@ import com.facebook.react.uimanager.ViewManager;
|
|||||||
@Override
|
@Override
|
||||||
public void addChildAt(CSSNode child, int i) {
|
public void addChildAt(CSSNode child, int i) {
|
||||||
super.addChildAt(child, i);
|
super.addChildAt(child, i);
|
||||||
((FlatShadowNode) child).forceMountToView();
|
if (child instanceof FlatShadowNode) {
|
||||||
|
((FlatShadowNode) child).forceMountToView();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -110,7 +110,7 @@ public class FlatUIImplementation extends UIImplementation {
|
|||||||
@Override
|
@Override
|
||||||
protected ReactShadowNode createShadowNode(String className) {
|
protected ReactShadowNode createShadowNode(String className) {
|
||||||
ReactShadowNode cssNode = super.createShadowNode(className);
|
ReactShadowNode cssNode = super.createShadowNode(className);
|
||||||
if (cssNode instanceof FlatShadowNode) {
|
if (cssNode instanceof FlatShadowNode || cssNode.isVirtual()) {
|
||||||
return cssNode;
|
return cssNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,15 +122,19 @@ public class FlatUIImplementation extends UIImplementation {
|
|||||||
ReactShadowNode cssNode,
|
ReactShadowNode cssNode,
|
||||||
int rootViewTag,
|
int rootViewTag,
|
||||||
@Nullable ReactStylesDiffMap styles) {
|
@Nullable ReactStylesDiffMap styles) {
|
||||||
FlatShadowNode node = (FlatShadowNode) cssNode;
|
if (cssNode instanceof FlatShadowNode) {
|
||||||
|
FlatShadowNode node = (FlatShadowNode) cssNode;
|
||||||
|
|
||||||
if (styles != null) {
|
if (styles != null) {
|
||||||
node.handleUpdateProperties(styles);
|
node.handleUpdateProperties(styles);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.mountsToView()) {
|
if (node.mountsToView()) {
|
||||||
int tag = cssNode.getReactTag();
|
int tag = cssNode.getReactTag();
|
||||||
mStateBuilder.ensureBackingViewIsCreated(node, tag, styles);
|
mStateBuilder.ensureBackingViewIsCreated(node, tag, styles);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.handleCreateView(cssNode, rootViewTag, styles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,13 +143,17 @@ public class FlatUIImplementation extends UIImplementation {
|
|||||||
ReactShadowNode cssNode,
|
ReactShadowNode cssNode,
|
||||||
String className,
|
String className,
|
||||||
ReactStylesDiffMap styles) {
|
ReactStylesDiffMap styles) {
|
||||||
FlatShadowNode node = (FlatShadowNode) cssNode;
|
if (cssNode instanceof FlatShadowNode) {
|
||||||
|
FlatShadowNode node = (FlatShadowNode) cssNode;
|
||||||
|
|
||||||
node.handleUpdateProperties(styles);
|
node.handleUpdateProperties(styles);
|
||||||
|
|
||||||
if (node.mountsToView()) {
|
if (node.mountsToView()) {
|
||||||
int tag = cssNode.getReactTag();
|
int tag = cssNode.getReactTag();
|
||||||
mStateBuilder.ensureBackingViewIsCreated(node, tag, styles);
|
mStateBuilder.ensureBackingViewIsCreated(node, tag, styles);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.handleUpdateView(cssNode, className, styles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user