Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix timers in headless tasks on bridgeless mode (#47496)
Summary: Fixes #47495 `JavaTimerManager` is being registered to receive headless tasks events in the [`TimingModule`](https://github.com/facebook/react-native/blob/0ee963ea65bcc88122044d51027511e611bde584/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.kt#L28-L29). This module is not used on bridgeless: [1](https://github.com/facebook/react-native/blob/0ee963ea65bcc88122044d51027511e611bde584/packages/react-native/Libraries/Core/setUpTimers.js#L44-L61), [2](https://github.com/facebook/react-native/blob/0ee963ea65bcc88122044d51027511e611bde584/packages/react-native/Libraries/Core/setUpTimers.js#L123-L132) and since it's loaded lazily, the event listener is never registered. This PR moves registration to the constructor of `JavaTimerManager` and deregistration to the `onInstanceDestroy` method. This way the event listener is always registered when an instance of the timer manager exists. ## Changelog: [ANDROID] [FIXED] - Fix timers in headless tasks on bridgeless mode Pull Request resolved: #47496 Test Plan: See the reproducer from the issue Reviewed By: javache Differential Revision: D65615601 Pulled By: alanleedev fbshipit-source-id: 6e1d36f8783e813065f79730a928b99c3e385718
- Loading branch information