File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
packages/react-native/ReactCommon/react/renderer/animated Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -1044,13 +1044,20 @@ void NativeAnimatedNodesManager::onRender() {
10441044
10451045 {
10461046 // Flush async created animated nodes
1047- std::lock_guard<std::mutex> lock (animatedNodesCreatedAsyncMutex_);
1048- std::lock_guard<std::mutex> lockCreateAsync (connectedAnimatedNodesMutex_);
1049- for (auto & [tag, node] : animatedNodesCreatedAsync_) {
1050- animatedNodes_.insert ({tag, std::move (node)});
1051- updatedNodeTags_.insert (tag);
1047+ std::unordered_map<Tag, std::unique_ptr<AnimatedNode>>
1048+ animatedNodesCreatedAsync;
1049+ {
1050+ std::lock_guard<std::mutex> lock (animatedNodesCreatedAsyncMutex_);
1051+ std::swap (animatedNodesCreatedAsync, animatedNodesCreatedAsync_);
1052+ }
1053+
1054+ if (!animatedNodesCreatedAsync.empty ()) {
1055+ std::lock_guard<std::mutex> lock (connectedAnimatedNodesMutex_);
1056+ for (auto & [tag, node] : animatedNodesCreatedAsync) {
1057+ animatedNodes_.insert ({tag, std::move (node)});
1058+ updatedNodeTags_.insert (tag);
1059+ }
10521060 }
1053- animatedNodesCreatedAsync_.clear ();
10541061 }
10551062
10561063 // Run operations scheduled from AnimatedModule
You can’t perform that action at this time.
0 commit comments