Fabric: Overriden equality operator for ViewShadowNode

Summary:
Computed `layoutMetrics` are also considered as part of ViewShadowNode's value.
In the future we probably have to add something like `localData` and `imperativeCommands`.
We need all this for diffing algorithm and mointing phase.

Reviewed By: mdvacca

Differential Revision: D7467800

fbshipit-source-id: 8a0dcf1fd2f97dc501d6969cb0b0f6a2c6a648b4
This commit is contained in:
Valentin Shergin authored and Facebook Github Bot committed 2018-04-10 12:59:51 -07:00
1 parent fec0a51e85
commit 1a4b6f0b3d
2 files changed
+12

No files matched your search

@@ -97,9 +97,17 @@ SharedLayoutableShadowNode ViewShadowNode::cloneAndReplaceChild(const SharedLayo
auto viewShadowNodeChildClone = std::make_shared<const ViewShadowNode>(viewShadowNodeChild);
ShadowNode::replaceChild(viewShadowNodeChild, viewShadowNodeChildClone);
return std::static_pointer_cast<const LayoutableShadowNode>(viewShadowNodeChildClone);
}
#pragma mark - Equality
bool ViewShadowNode::operator==(const ShadowNode& rhs) const {
if (!ShadowNode::operator==(rhs)) {
return false;
}
auto &&other = static_cast<const ViewShadowNode&>(rhs);
return getLayoutMetrics() == other.getLayoutMetrics();
}
#pragma mark - DebugStringConvertible
+4
View File
@@ -48,6 +48,10 @@ public:
void appendChild(const SharedShadowNode &child);
#pragma mark - Equality
bool operator==(const ShadowNode& rhs) const override;
#pragma mark - DebugStringConvertible
SharedDebugStringConvertibleList getDebugProps() const override;