void UIManager::setNativeProps( const SharedShadowNode &shadowNode, const RawProps &rawProps) const { SystraceSection s("UIManager::setNativeProps"); auto &componentDescriptor = shadowNode->getComponentDescriptor(); auto props = componentDescriptor.cloneProps(shadowNode->getProps(), rawProps); auto newShadowNode = shadowNode->clone({ /* .tag = */ ShadowNodeFragment::tagPlaceholder(), /* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(), /* .props = */ props, }); shadowTreeRegistry_->visit( shadowNode->getSurfaceId(), [&](const ShadowTree &shadowTree) { shadowTree.tryCommit( [&](const SharedRootShadowNode &oldRootShadowNode) { return oldRootShadowNode->clone(shadowNode, newShadowNode); }); }); }
SharedShadowNode UIManager::cloneNode( const SharedShadowNode &shadowNode, const SharedShadowNodeSharedList &children, const RawProps *rawProps) const { SystraceSection s("UIManager::cloneNode"); auto &componentDescriptor = shadowNode->getComponentDescriptor(); auto clonedShadowNode = componentDescriptor.cloneShadowNode( *shadowNode, { /* .tag = */ ShadowNodeFragment::tagPlaceholder(), /* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(), /* .props = */ rawProps ? componentDescriptor.cloneProps( shadowNode->getProps(), *rawProps) : ShadowNodeFragment::propsPlaceholder(), /* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(), /* .children = */ children, }); return clonedShadowNode; }