Fabric: Proper return value of `LayoutableShadowNode::setLayoutMetrics()`
Summary: `LayoutableShadowNode::setLayoutMetrics()` must return `false` is nothing was changes. Reviewed By: fkgozali Differential Revision: D7330334 fbshipit-source-id: 700d50b0047919fa2b919acfa72825f100cd496f
This commit is contained in:
parent
aaaa946e6d
commit
a5a34565e0
|
@ -22,6 +22,16 @@ struct LayoutMetrics {
|
|||
EdgeInsets borderWidth {0};
|
||||
DisplayType displayType {Flex};
|
||||
LayoutDirection layoutDirection {Undefined};
|
||||
|
||||
bool operator ==(const LayoutMetrics& rhs) const {
|
||||
return
|
||||
std::tie(this->frame, this->contentInsets, this->borderWidth, this->displayType, this->layoutDirection) ==
|
||||
std::tie(rhs.frame, rhs.contentInsets, rhs.borderWidth, rhs.displayType, rhs.layoutDirection);
|
||||
}
|
||||
|
||||
bool operator !=(const LayoutMetrics& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
|
|
|
@ -19,6 +19,10 @@ LayoutMetrics LayoutableShadowNode::getLayoutMetrics() const {
|
|||
}
|
||||
|
||||
bool LayoutableShadowNode::setLayoutMetrics(LayoutMetrics layoutMetrics) {
|
||||
if (layoutMetrics_ == layoutMetrics) {
|
||||
return false;
|
||||
}
|
||||
|
||||
layoutMetrics_ = layoutMetrics;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue