diff --git a/packages/react-native/ReactCxxPlatform/react/renderer/animated/NativeAnimatedNodesManager.cpp b/packages/react-native/ReactCxxPlatform/react/renderer/animated/NativeAnimatedNodesManager.cpp index 8706e6b1364..9eebc9f62e8 100644 --- a/packages/react-native/ReactCxxPlatform/react/renderer/animated/NativeAnimatedNodesManager.cpp +++ b/packages/react-native/ReactCxxPlatform/react/renderer/animated/NativeAnimatedNodesManager.cpp @@ -299,30 +299,30 @@ void NativeAnimatedNodesManager::startAnimatingNode( if (auto iter = activeAnimations_.find(animationId); iter != activeAnimations_.end()) { // reset animation config - auto animation = iter->second; + auto& animation = iter->second; animation->updateConfig(config); } else if (animatedNodes_.contains(animatedNodeTag)) { auto type = config["type"].asString(); auto typeEnum = AnimationDriver::getDriverTypeByName(type); - std::shared_ptr animation = nullptr; + std::unique_ptr animation = nullptr; if (typeEnum) { switch (typeEnum.value()) { case AnimationDriverType::Frames: { - animation = std::make_shared( + animation = std::make_unique( animationId, animatedNodeTag, endCallback, config, this); } break; case AnimationDriverType::Spring: { - animation = std::make_shared( + animation = std::make_unique( animationId, animatedNodeTag, endCallback, config, this); } break; case AnimationDriverType::Decay: { - animation = std::make_shared( + animation = std::make_unique( animationId, animatedNodeTag, endCallback, config, this); } break; } if (animation) { - activeAnimations_.insert({animationId, animation}); animation->startAnimation(); + activeAnimations_.insert({animationId, std::move(animation)}); } } else { LOG(ERROR) << "Unknown AnimationDriver type " << type; diff --git a/packages/react-native/ReactCxxPlatform/react/renderer/animated/NativeAnimatedNodesManager.h b/packages/react-native/ReactCxxPlatform/react/renderer/animated/NativeAnimatedNodesManager.h index f2a34162646..7365990b738 100644 --- a/packages/react-native/ReactCxxPlatform/react/renderer/animated/NativeAnimatedNodesManager.h +++ b/packages/react-native/ReactCxxPlatform/react/renderer/animated/NativeAnimatedNodesManager.h @@ -197,7 +197,7 @@ class NativeAnimatedNodesManager std::unordered_map> animatedNodes_; std::unordered_map connectedAnimatedNodes_; - std::unordered_map> activeAnimations_; + std::unordered_map> activeAnimations_; std::unordered_map< EventAnimationDriverKey, std::vector>,