Skip to content

Commit 793023a

Browse files
zeyapfacebook-github-bot
authored andcommitted
Fewer calls to direct manipulation callback (#52296)
Summary: Pull Request resolved: #52296 ## Changelog: [Internal] [Changed] - Fewer calls to direct manipulation callback `NativeAnimatedNodesManager::onRender` is supposed to run each frame for c++ animation, from the callstack sample trace, the vast majority of time is spent on `updateNodes` (run update on all AnimatedNodes) and `commitProps` (where either Fabric ShadowTree commit or direct manipulation is called). Change in this PR is supposed to reduce time spent in `commitProps` {F1979788964} Reviewed By: sammy-SC Differential Revision: D77380842 fbshipit-source-id: 2f25ca1fba4171a7b3e485298738379d0daff3ad
1 parent ffd6e55 commit 793023a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/react-native/ReactCxxPlatform/react/renderer/animated/NativeAnimatedNodesManager.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,9 @@ void NativeAnimatedNodesManager::schedulePropsCommit(
743743
(layoutStyleUpdated || forceFabricCommit ||
744744
directManipulationCallback_ == nullptr)) {
745745
mergeObjects(updateViewProps_[viewTag], props);
746+
747+
// Must call direct manipulation to set final values on components.
748+
mergeObjects(updateViewPropsDirect_[viewTag], props);
746749
} else if (directManipulationCallback_ != nullptr) {
747750
mergeObjects(updateViewPropsDirect_[viewTag], props);
748751
}
@@ -811,12 +814,6 @@ bool NativeAnimatedNodesManager::commitProps() {
811814

812815
if (fabricCommitCallback_ != nullptr) {
813816
if (!updateViewProps_.empty()) {
814-
// Must call direct manipulation to set final values on components.
815-
if (directManipulationCallback_ != nullptr) {
816-
for (const auto& [viewTag, props] : updateViewProps_) {
817-
directManipulationCallback_(viewTag, folly::dynamic(props));
818-
}
819-
}
820817
fabricCommitCallback_(updateViewProps_);
821818
updateViewProps_.clear();
822819
}

0 commit comments

Comments
 (0)