Java Code Examples for com.facebook.react.uimanager.ReactShadowNode#mutableCopyWithNewChildren()
The following examples show how to use
com.facebook.react.uimanager.ReactShadowNode#mutableCopyWithNewChildren() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FabricUIManager.java From react-native-GPay with MIT License | 6 votes |
/** * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned * ReactShadowNode will contain a copy of all the internal data of the original node, but its * children set will be empty. */ @Nullable @DoNotStrip public ReactShadowNode cloneNodeWithNewChildren(ReactShadowNode node) { if (DEBUG) { FLog.d(TAG, "cloneNodeWithNewChildren \n\tnode: " + node); } SystraceMessage.beginSection( Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricUIManager.cloneNodeWithNewChildren") .flush(); try { ReactShadowNode clone = node.mutableCopyWithNewChildren(node.getInstanceHandle()); assertReactShadowNodeCopy(node, clone); return clone; } catch (Throwable t) { handleException(node, t); return null; } finally{ Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } }
Example 2
Source File: FabricUIManager.java From react-native-GPay with MIT License | 5 votes |
private ReactShadowNode calculateDiffingAndCreateNewRootNode( ReactShadowNode currentRootShadowNode, List<ReactShadowNode> newChildList) { SystraceMessage.beginSection( Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricUIManager.calculateDiffingAndCreateNewRootNode") .flush(); try { ReactShadowNode newRootShadowNode = currentRootShadowNode.mutableCopyWithNewChildren(currentRootShadowNode.getInstanceHandle()); for (ReactShadowNode child : newChildList) { appendChild(newRootShadowNode, child); } if (DEBUG) { FLog.d( TAG, "ReactShadowNodeHierarchy before calculateLayout: " + newRootShadowNode.getHierarchyInfo()); } notifyOnBeforeLayoutRecursive(newRootShadowNode); calculateLayout(newRootShadowNode); if (DEBUG) { FLog.d( TAG, "ReactShadowNodeHierarchy after calculateLayout: " + newRootShadowNode.getHierarchyInfo()); } mFabricReconciler.manageChildren(currentRootShadowNode, newRootShadowNode); return newRootShadowNode; } finally{ Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } }