fix(core): vsync event used by frame is stopped by animation ending

This commit is contained in:
etkmao
2025-09-19 11:00:06 +08:00
parent 2c076e742d
commit 70877a59eb
4 changed files with 24 additions and 1 deletions
@@ -73,6 +73,7 @@ void AnimationFrameModule::RequestAnimationFrame(hippy::napi::CallbackInfo &info
}
has_event_listener_ = true;
root_node->SetVSyncEventNeedSource(VSyncEventNeedByFrame);
listener_id_ = hippy::dom::FetchListenerId();
auto weak_this = weak_from_this();
std::weak_ptr<Scope> weak_scope = scope;
@@ -112,6 +113,7 @@ void AnimationFrameModule::CancelAnimationFrame(hippy::napi::CallbackInfo &info,
return;
}
root_node->UnsetVSyncEventNeedSource(VSyncEventNeedByFrame);
dom_manager->RemoveEventListener(root_node, root_node->GetId(), kVSyncKey, listener_id_);
dom_manager->EndBatch(root_node);