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); }); }); }
void UIManager::updateState( const SharedShadowNode &shadowNode, const StateData::Shared &rawStateData) const { auto &componentDescriptor = shadowNode->getComponentDescriptor(); auto state = componentDescriptor.createState(shadowNode->getState(), rawStateData); auto newShadowNode = shadowNode->clone({ /* .tag = */ ShadowNodeFragment::tagPlaceholder(), /* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(), /* .props = */ ShadowNodeFragment::propsPlaceholder(), /* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(), /* .children = */ ShadowNodeFragment::childrenPlaceholder(), /* .localData = */ ShadowNodeFragment::localDataPlaceholder(), /* .state = */ state, }); shadowTreeRegistry_->visit( shadowNode->getSurfaceId(), [&](const ShadowTree &shadowTree) { shadowTree.tryCommit( [&](const SharedRootShadowNode &oldRootShadowNode) { return oldRootShadowNode->clone(shadowNode, newShadowNode); }); }); }