diff --git a/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h b/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h index 0ec1cba19..165da0716 100644 --- a/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h +++ b/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h @@ -113,9 +113,8 @@ private: ShadowNodeCloneFunction getCloneFunction() const { if (!cloneFunction_) { - cloneFunction_ = [this](const SharedShadowNode &shadowNode, const ShadowNodeFragment &fragment) { - assert(std::dynamic_pointer_cast(shadowNode)); - return this->cloneShadowNode(*shadowNode, fragment); + cloneFunction_ = [this](const ShadowNode &shadowNode, const ShadowNodeFragment &fragment) { + return this->cloneShadowNode(shadowNode, fragment); }; } diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp index 2fc759237..6310cab5f 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp +++ b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp @@ -60,7 +60,7 @@ ShadowNode::ShadowNode( UnsharedShadowNode ShadowNode::clone(const ShadowNodeFragment &fragment) const { assert(cloneFunction_); - return cloneFunction_(shared_from_this(), fragment); + return cloneFunction_(*this, fragment); } #pragma mark - Getters diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.h b/ReactCommon/fabric/core/shadownode/ShadowNode.h index dca542b3f..3f60b3d45 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.h +++ b/ReactCommon/fabric/core/shadownode/ShadowNode.h @@ -32,7 +32,7 @@ using SharedShadowNodeSharedList = std::shared_ptr; using SharedShadowNodeUnsharedList = std::shared_ptr; using ShadowNodeCloneFunction = std::function; diff --git a/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp b/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp index 4a7507f62..386b33460 100644 --- a/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp +++ b/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp @@ -117,9 +117,9 @@ TEST(ShadowNodeTest, handleCloneFunction) { .props = std::make_shared(), .children = ShadowNode::emptySharedShadowNodeSharedList() }, - [](const SharedShadowNode &shadowNode, const ShadowNodeFragment &fragment) { + [](const ShadowNode &shadowNode, const ShadowNodeFragment &fragment) { return std::make_shared( - *std::static_pointer_cast(shadowNode), + shadowNode, fragment ); }