mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
pass config in C++ Animated with std::move (#52039)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52039 changelog: [internal] config can be passed with std::move to avoid copy. Reviewed By: rshest, javache Differential Revision: D76628921 fbshipit-source-id: 82a90ce604d2a82a388eb4fa63f22deda6ec92ed
This commit is contained in:
1 parent
d20b9cfdf0
commit
ffe928ce50
9 files changed
+19
-16
No files matched your search
@@ -241,7 +241,10 @@ void AnimatedModule::executeOperation(const Operation& operation) {
|
||||
nodesManager_->disconnectAnimatedNodes(op.parentTag, op.childTag);
|
||||
} else if constexpr (std::is_same_v<T, StartAnimatingNodeOp>) {
|
||||
nodesManager_->startAnimatingNode(
|
||||
op.animationId, op.nodeTag, op.config, std::move(op.endCallback));
|
||||
op.animationId,
|
||||
op.nodeTag,
|
||||
std::move(op.config),
|
||||
std::move(op.endCallback));
|
||||
} else if constexpr (std::is_same_v<T, StopAnimationOp>) {
|
||||
nodesManager_->stopAnimation(op.animationId, false);
|
||||
} else if constexpr (std::is_same_v<T, SetAnimatedNodeValueOp>) {
|
||||
|
||||
+4
-4
@@ -273,7 +273,7 @@ void NativeAnimatedNodesManager::stopAnimationsForNode(Tag nodeTag) {
|
||||
void NativeAnimatedNodesManager::startAnimatingNode(
|
||||
int animationId,
|
||||
Tag animatedNodeTag,
|
||||
const folly::dynamic& config,
|
||||
folly::dynamic config,
|
||||
std::optional<AnimationEndCallback> endCallback) noexcept {
|
||||
if (auto iter = activeAnimations_.find(animationId);
|
||||
iter != activeAnimations_.end()) {
|
||||
@@ -291,7 +291,7 @@ void NativeAnimatedNodesManager::startAnimatingNode(
|
||||
animationId,
|
||||
animatedNodeTag,
|
||||
std::move(endCallback),
|
||||
config,
|
||||
std::move(config),
|
||||
this);
|
||||
} break;
|
||||
case AnimationDriverType::Spring: {
|
||||
@@ -299,7 +299,7 @@ void NativeAnimatedNodesManager::startAnimatingNode(
|
||||
animationId,
|
||||
animatedNodeTag,
|
||||
std::move(endCallback),
|
||||
config,
|
||||
std::move(config),
|
||||
this);
|
||||
} break;
|
||||
case AnimationDriverType::Decay: {
|
||||
@@ -307,7 +307,7 @@ void NativeAnimatedNodesManager::startAnimatingNode(
|
||||
animationId,
|
||||
animatedNodeTag,
|
||||
std::move(endCallback),
|
||||
config,
|
||||
std::move(config),
|
||||
this);
|
||||
} break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ class NativeAnimatedNodesManager {
|
||||
void startAnimatingNode(
|
||||
int animationId,
|
||||
Tag animatedNodeTag,
|
||||
const folly::dynamic& config,
|
||||
folly::dynamic config,
|
||||
std::optional<AnimationEndCallback> endCallback) noexcept;
|
||||
|
||||
void stopAnimation(
|
||||
|
||||
+3
-3
@@ -18,15 +18,15 @@ DecayAnimationDriver::DecayAnimationDriver(
|
||||
int id,
|
||||
Tag animatedValueTag,
|
||||
std::optional<AnimationEndCallback> endCallback,
|
||||
const folly::dynamic& config,
|
||||
folly::dynamic config,
|
||||
NativeAnimatedNodesManager* manager)
|
||||
: AnimationDriver(
|
||||
id,
|
||||
animatedValueTag,
|
||||
std::move(endCallback),
|
||||
config,
|
||||
std::move(config),
|
||||
manager),
|
||||
velocity_(config["velocity"].asDouble()),
|
||||
velocity_(config_["velocity"].asDouble()),
|
||||
deceleration_(config_["deceleration"].asDouble()) {
|
||||
react_native_assert(deceleration_ > 0);
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ class DecayAnimationDriver : public AnimationDriver {
|
||||
int id,
|
||||
Tag animatedValueTag,
|
||||
std::optional<AnimationEndCallback> endCallback,
|
||||
const folly::dynamic& config,
|
||||
folly::dynamic config,
|
||||
NativeAnimatedNodesManager* manager);
|
||||
|
||||
protected:
|
||||
|
||||
+2
-2
@@ -24,13 +24,13 @@ FrameAnimationDriver::FrameAnimationDriver(
|
||||
int id,
|
||||
Tag animatedValueTag,
|
||||
std::optional<AnimationEndCallback> endCallback,
|
||||
const folly::dynamic& config,
|
||||
folly::dynamic config,
|
||||
NativeAnimatedNodesManager* manager)
|
||||
: AnimationDriver(
|
||||
id,
|
||||
animatedValueTag,
|
||||
std::move(endCallback),
|
||||
config,
|
||||
std::move(config),
|
||||
manager) {
|
||||
onConfigChanged();
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ class FrameAnimationDriver : public AnimationDriver {
|
||||
int id,
|
||||
Tag animatedValueTag,
|
||||
std::optional<AnimationEndCallback> endCallback,
|
||||
const folly::dynamic& config,
|
||||
folly::dynamic config,
|
||||
NativeAnimatedNodesManager* manager);
|
||||
|
||||
protected:
|
||||
|
||||
+2
-2
@@ -21,13 +21,13 @@ SpringAnimationDriver::SpringAnimationDriver(
|
||||
int id,
|
||||
Tag animatedValueTag,
|
||||
std::optional<AnimationEndCallback> endCallback,
|
||||
const folly::dynamic& config,
|
||||
folly::dynamic config,
|
||||
NativeAnimatedNodesManager* manager)
|
||||
: AnimationDriver(
|
||||
id,
|
||||
animatedValueTag,
|
||||
std::move(endCallback),
|
||||
config,
|
||||
std::move(config),
|
||||
manager),
|
||||
springStiffness_(config_["stiffness"].asDouble()),
|
||||
springDamping_(config_["damping"].asDouble()),
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ class SpringAnimationDriver : public AnimationDriver {
|
||||
int id,
|
||||
Tag animatedValueTag,
|
||||
std::optional<AnimationEndCallback> endCallback,
|
||||
const folly::dynamic& config,
|
||||
folly::dynamic config,
|
||||
NativeAnimatedNodesManager* manager);
|
||||
|
||||
protected:
|
||||
|
||||
Reference in new issue
Block a user