clean up interface of AnimationDriver (#51663)

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

changelog: [internal]

mark getters as noexcept const and use `get` prefix.

Reviewed By: christophpurrer

Differential Revision: D75531202

fbshipit-source-id: d66132ee3ec459e73ab3dc33c726c73d5afb6e72
This commit is contained in:
Samuel Susla
2025-05-28 14:18:24 -07:00
committed by Facebook GitHub Bot
parent a4c2007068
commit 091eb2ea11
4 changed files with 8 additions and 18 deletions
@@ -243,7 +243,7 @@ void NativeAnimatedNodesManager::stopAnimationsForNode(Tag nodeTag) {
std::vector<int> discardedAnimIds{};
for (const auto& [animationId, driver] : activeAnimations_) {
if (driver->animatedValueTag() == nodeTag) {
if (driver->getAnimatedValueTag() == nodeTag) {
discardedAnimIds.emplace_back(animationId);
}
}
@@ -612,9 +612,9 @@ bool NativeAnimatedNodesManager::onAnimationFrame(uint64_t timestamp) {
for (const auto& [_id, driver] : activeAnimations_) {
driver->runAnimationStep(timestamp);
if (driver->isComplete()) {
if (driver->getIsComplete()) {
hasFinishedAnimations = true;
finishedAnimationValueNodes.insert(driver->animatedValueTag());
finishedAnimationValueNodes.insert(driver->getAnimatedValueTag());
}
}
@@ -625,8 +625,8 @@ bool NativeAnimatedNodesManager::onAnimationFrame(uint64_t timestamp) {
if (hasFinishedAnimations) {
std::vector<int> finishedAnimations;
for (const auto& [animationId, driver] : activeAnimations_) {
if (driver->isComplete()) {
if (getAnimatedNode<ValueAnimatedNode>(driver->animatedValueTag())) {
if (driver->getIsComplete()) {
if (getAnimatedNode<ValueAnimatedNode>(driver->getAnimatedValueTag())) {
driver->stopAnimation();
}
finishedAnimations.emplace_back(animationId);
@@ -34,11 +34,11 @@ class AnimationDriver {
void startAnimation();
void stopAnimation(bool ignoreCompletedHandlers = false);
inline constexpr int Id() {
inline int getId() const noexcept {
return id_;
}
inline constexpr Tag animatedValueTag() {
inline Tag getAnimatedValueTag() const noexcept {
return animatedValueTag_;
}
@@ -46,11 +46,7 @@ class AnimationDriver {
return endCallback_;
}
virtual double toValue() const noexcept {
return 0;
}
bool isComplete() const noexcept {
bool getIsComplete() const noexcept {
return isComplete_;
}
@@ -35,10 +35,6 @@ FrameAnimationDriver::FrameAnimationDriver(
onConfigChanged();
}
double FrameAnimationDriver::toValue() const noexcept {
return toValue_;
}
void FrameAnimationDriver::updateConfig(folly::dynamic config) {
AnimationDriver::updateConfig(config);
onConfigChanged();
@@ -24,8 +24,6 @@ class FrameAnimationDriver : public AnimationDriver {
const folly::dynamic& config,
NativeAnimatedNodesManager* manager);
double toValue() const noexcept override;
protected:
bool update(double timeDeltaMs, bool restarting) override;