mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Simplification of UIManager::getRelativeLayoutMetrics
Summary: Using of the new API makes clear that we don't need to calculate the newest descendant node. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D21480202 fbshipit-source-id: c54998573baffe4a05726e3402da027f052b049a
This commit is contained in:
1 parent
caab26e0c3
commit
dafa975352
1 file changed
+6
-11
@@ -213,27 +213,22 @@ LayoutMetrics UIManager::getRelativeLayoutMetrics(
|
||||
true);
|
||||
});
|
||||
} else {
|
||||
// It is possible for JavaScript (or other callers) to have a reference
|
||||
// to a previous version of ShadowNodes, but we enforce that
|
||||
// metrics are only calculated on most recently committed versions.
|
||||
owningAncestorShadowNode = getNewestCloneOfShadowNode(*ancestorShadowNode);
|
||||
ancestorShadowNode = owningAncestorShadowNode.get();
|
||||
}
|
||||
|
||||
// Get latest version of both the ShadowNode and its ancestor.
|
||||
// It is possible for JS (or other callers) to have a reference
|
||||
// to a previous version of ShadowNodes, but we enforce that
|
||||
// metrics are only calculated on most recently committed versions.
|
||||
auto newestShadowNode = getNewestCloneOfShadowNode(shadowNode);
|
||||
|
||||
auto layoutableShadowNode =
|
||||
traitCast<LayoutableShadowNode const *>(newestShadowNode.get());
|
||||
auto layoutableAncestorShadowNode =
|
||||
traitCast<LayoutableShadowNode const *>(ancestorShadowNode);
|
||||
|
||||
if (!layoutableShadowNode || !layoutableAncestorShadowNode) {
|
||||
if (!layoutableAncestorShadowNode) {
|
||||
return EmptyLayoutMetrics;
|
||||
}
|
||||
|
||||
return layoutableShadowNode->getRelativeLayoutMetrics(
|
||||
*layoutableAncestorShadowNode, policy);
|
||||
return LayoutableShadowNode::computeRelativeLayoutMetrics(
|
||||
shadowNode.getFamily(), *layoutableAncestorShadowNode, policy);
|
||||
}
|
||||
|
||||
void UIManager::updateState(StateUpdate const &stateUpdate) const {
|
||||
|
||||
Reference in new issue
Block a user