mirror of
https://github.com/status-im/react-native.git
synced 2025-02-04 13:44:04 +00:00
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:
parent
fec0a51e85
commit
1a4b6f0b3d
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user