diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp index 27281d9fc45..f3567d33a7f 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp +++ b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp @@ -142,10 +142,6 @@ State::Shared ShadowNode::getMostRecentState() const { return ShadowNodeFragment::statePlaceholder(); } -SharedLocalData ShadowNode::getLocalData() const { - return localData_; -} - void ShadowNode::sealRecursive() const { if (getSealed()) { return; @@ -206,11 +202,6 @@ void ShadowNode::replaceChild( assert(false && "Child to replace was not found."); } -void ShadowNode::setLocalData(const SharedLocalData &localData) { - ensureUnsealed(); - localData_ = localData; -} - void ShadowNode::cloneChildrenIfShared() { if (!traits_.check(ShadowNodeTraits::Trait::ChildrenAreShared)) { return; diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.h b/ReactCommon/fabric/core/shadownode/ShadowNode.h index 9021c4e4aea..cc3471f8073 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.h +++ b/ReactCommon/fabric/core/shadownode/ShadowNode.h @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -126,14 +125,6 @@ class ShadowNode : public virtual Sealable, */ State::Shared getMostRecentState() const; - /* - * Returns a local data associated with the node. - * `LocalData` object might be used for data exchange between native view and - * shadow node instances. - * Concrete type of the object depends on concrete type of the `ShadowNode`. - */ - SharedLocalData getLocalData() const; - void sealRecursive() const; #pragma mark - Mutating Methods @@ -144,12 +135,6 @@ class ShadowNode : public virtual Sealable, ShadowNode::Shared const &newChild, int suggestedIndex = -1); - /* - * Sets local data associated with the node. - * The node must be unsealed at this point. - */ - void setLocalData(const SharedLocalData &localData); - /* * Performs all side effects associated with mounting/unmounting in one place. * This is not `virtual` on purpose, do not override this. @@ -187,7 +172,6 @@ class ShadowNode : public virtual Sealable, protected: SharedProps props_; SharedShadowNodeSharedList children_; - SharedLocalData localData_; State::Shared state_; private: diff --git a/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp b/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp index 0ad36960db5..bab859649d3 100644 --- a/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp +++ b/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp @@ -204,14 +204,6 @@ TEST_F(ShadowNodeTest, handleShadowNodeMutation) { EXPECT_TRUE(nodeAB_->getSealed()); EXPECT_TRUE(nodeABArevision2->getSealed()); EXPECT_TRUE(nodeABB_->getSealed()); - - // No more mutation after sealing. - EXPECT_THROW(nodeABArevision2->setLocalData(nullptr), std::runtime_error); - - auto nodeABArevision3 = - std::make_shared(*nodeABArevision2, ShadowNodeFragment{}); - nodeABArevision3->setLocalData(nullptr); - EXPECT_EQ(nodeABArevision3->getLocalData(), nullptr); } TEST_F(ShadowNodeTest, handleCloneFunction) { @@ -230,32 +222,6 @@ TEST_F(ShadowNodeTest, handleCloneFunction) { EXPECT_EQ(nodeAB_->getProps(), nodeABClone->getProps()); } -TEST_F(ShadowNodeTest, handleLocalData) { - auto localData42 = std::make_shared(); - localData42->setNumber(42); - - auto anotherLocalData42 = std::make_shared(); - anotherLocalData42->setNumber(42); - - auto localDataOver9000 = std::make_shared(); - localDataOver9000->setNumber(9001); - auto props = std::make_shared(); - - nodeAA_->setLocalData(localData42); - nodeAB_->setLocalData(localData42); - nodeAC_->setLocalData(localDataOver9000); - - // LocalData object are compared by pointer, not by value. - EXPECT_EQ(nodeAA_->getLocalData(), nodeAB_->getLocalData()); - EXPECT_NE(nodeAA_->getLocalData(), nodeAC_->getLocalData()); - nodeAB_->setLocalData(anotherLocalData42); - EXPECT_NE(nodeAA_->getLocalData(), nodeAB_->getLocalData()); - - // LocalData cannot be changed for sealed shadow node. - nodeAB_->sealRecursive(); - EXPECT_ANY_THROW(nodeAB_->setLocalData(localDataOver9000)); -} - TEST_F(ShadowNodeTest, handleBacktracking) { // Negative case: auto ancestors1 = nodeZ_->getAncestors(*nodeA_); diff --git a/ReactCommon/fabric/mounting/ShadowView.cpp b/ReactCommon/fabric/mounting/ShadowView.cpp index 35b244d7337..e78e765ba19 100644 --- a/ReactCommon/fabric/mounting/ShadowView.cpp +++ b/ReactCommon/fabric/mounting/ShadowView.cpp @@ -26,7 +26,7 @@ ShadowView::ShadowView(const ShadowNode &shadowNode) props(shadowNode.getProps()), eventEmitter(shadowNode.getEventEmitter()), layoutMetrics(layoutMetricsFromShadowNode(shadowNode)), - localData(shadowNode.getLocalData()), + localData({}), state(shadowNode.getState()) {} bool ShadowView::operator==(const ShadowView &rhs) const {