Fabric: Using a proper Component Descriptor for node cloning
Summary: To clone a ShadowNode we must use node's ComponentDescriptot, not parent node's one. Reviewed By: mdvacca Differential Revision: D7738583 fbshipit-source-id: 83656f9a761530cdaedf65663ae28b3119af75f5
This commit is contained in:
parent
3428808b97
commit
6aa52f2684
|
@ -81,6 +81,7 @@ private:
|
||||||
ShadowNodeCloneFunction getCloneFunction() const {
|
ShadowNodeCloneFunction getCloneFunction() const {
|
||||||
if (!cloneFunction_) {
|
if (!cloneFunction_) {
|
||||||
cloneFunction_ = [this](const SharedShadowNode &shadowNode, const SharedProps &props, const SharedShadowNodeSharedList &children) {
|
cloneFunction_ = [this](const SharedShadowNode &shadowNode, const SharedProps &props, const SharedShadowNodeSharedList &children) {
|
||||||
|
assert(std::dynamic_pointer_cast<const ShadowNodeT>(shadowNode));
|
||||||
return this->cloneShadowNode(shadowNode, props, children);
|
return this->cloneShadowNode(shadowNode, props, children);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,8 @@ void FabricUIManager::appendChild(const SharedShadowNode &parentShadowNode, cons
|
||||||
|
|
||||||
// TODO: Remove this after we move this to JS side.
|
// TODO: Remove this after we move this to JS side.
|
||||||
if (childShadowNode->getSealed()) {
|
if (childShadowNode->getSealed()) {
|
||||||
auto clonedChildShadowNode = componentDescriptor->cloneShadowNode(childShadowNode);
|
auto childComponentDescriptor = (*componentDescriptorRegistry_)[childShadowNode];
|
||||||
|
auto clonedChildShadowNode = childComponentDescriptor->cloneShadowNode(childShadowNode);
|
||||||
auto nonConstClonedChildShadowNode = std::const_pointer_cast<ShadowNode>(clonedChildShadowNode);
|
auto nonConstClonedChildShadowNode = std::const_pointer_cast<ShadowNode>(clonedChildShadowNode);
|
||||||
nonConstClonedChildShadowNode->shallowSourceNode();
|
nonConstClonedChildShadowNode->shallowSourceNode();
|
||||||
componentDescriptor->appendChild(parentShadowNode, clonedChildShadowNode);
|
componentDescriptor->appendChild(parentShadowNode, clonedChildShadowNode);
|
||||||
|
|
Loading…
Reference in New Issue