avoid copy of shadowView in Differentiator (#49268)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49268

changelog: [internal]

ShadowView has three shared_ptr and copying those can be avoided here. Let's use std::move.

Reviewed By: NickGerleman

Differential Revision: D69303346

fbshipit-source-id: b13103369f6423610dd8f8ccb293e59f04acc5dc
This commit is contained in:
Samuel Susla
2025-02-10 05:01:42 -08:00
committed by Facebook GitHub Bot
parent 13f4b7619d
commit e692ae1506
@@ -340,14 +340,18 @@ static void sliceChildShadowNodeViewPairsRecursively(
if (areChildrenFlattened) {
storedOrigin = origin;
}
scope.push_back(
{shadowView,
&childShadowNode,
areChildrenFlattened,
isConcreteView,
storedOrigin});
if (shadowView.layoutMetrics.positionType == PositionType::Static) {
auto isPositionStatic =
shadowView.layoutMetrics.positionType == PositionType::Static;
scope.push_back(
{.shadowView = std::move(shadowView),
.shadowNode = &childShadowNode,
.flattened = areChildrenFlattened,
.isConcreteView = isConcreteView,
.contextOrigin = storedOrigin});
if (isPositionStatic) {
auto it = pairList.begin();
std::advance(it, startOfStaticIndex);
pairList.insert(it, &scope.back());