Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/react-native/React/Fabric/RCTScheduler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ void schedulerDidUpdateShadowTree(const std::unordered_map<Tag, folly::dynamic>
// This delegate method is not currently used on iOS.
}

void schedulerShouldResumeAnimationFrameCallbacks() override
{
// Does nothing.
// This delegate method is not currently used on iOS.
}

void schedulerShouldPauseAnimationFrameCallbacks() override
{
// Does nothing.
// This delegate method is not currently used on iOS.
}

private:
void *scheduler_;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,10 @@ void FabricUIManagerBinding::schedulerDidUpdateShadowTree(
// no-op
}

void FabricUIManagerBinding::schedulerShouldResumeAnimationFrameCallbacks() {}

void FabricUIManagerBinding::schedulerShouldPauseAnimationFrameCallbacks() {}

void FabricUIManagerBinding::onAnimationStarted() {
auto mountingManager = getMountingManager("onAnimationStarted");
if (!mountingManager) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ class FabricUIManagerBinding : public jni::HybridClass<FabricUIManagerBinding>,

void schedulerDidUpdateShadowTree(const std::unordered_map<Tag, folly::dynamic> &tagToProps) override;

void schedulerShouldResumeAnimationFrameCallbacks() override;

void schedulerShouldPauseAnimationFrameCallbacks() override;

void setPixelDensity(float pointScaleFactor);

void driveCxxAnimations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ class SchedulerDelegate {

virtual void schedulerDidUpdateShadowTree(const std::unordered_map<Tag, folly::dynamic> &tagToProps) = 0;

/*
* Called when the animation backend should start receiving frame callbacks.
* This is used to control the platform-specific animation frame scheduling.
*/
virtual void schedulerShouldResumeAnimationFrameCallbacks() = 0;

/*
* Called when the animation backend should stop receiving frame callbacks.
* This is used to pause the platform-specific animation frame scheduling.
*/
virtual void schedulerShouldPauseAnimationFrameCallbacks() = 0;

virtual ~SchedulerDelegate() noexcept = default;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,12 @@ void SchedulerDelegateImpl::schedulerDidUpdateShadowTree(
mountingManager_->onUpdateShadowTree(tagToProps);
}

void SchedulerDelegateImpl::schedulerShouldResumeAnimationFrameCallbacks() {
// no-op for ReactCxxPlatform
}

void SchedulerDelegateImpl::schedulerShouldPauseAnimationFrameCallbacks() {
// no-op for ReactCxxPlatform
}

} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class SchedulerDelegateImpl : public SchedulerDelegate {

void schedulerDidUpdateShadowTree(const std::unordered_map<Tag, folly::dynamic> &tagToProps) override;

void schedulerShouldResumeAnimationFrameCallbacks() override;

void schedulerShouldPauseAnimationFrameCallbacks() override;

std::shared_ptr<IMountingManager> mountingManager_;
};

Expand Down
Loading