-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the future of Headless JS? #45731
Comments
|
|
|
|
And listen, pushing everyone in the community away with an auto-close bot isn't helping. |
That's because this is an issue tracker only. It's not the right spot for questions/discussions. The best place is here https://github.com/react-native-community/discussions-and-proposals (there is even a button in https://github.com/facebook/react-native/issues/new/choose). To answer your question: we'll most likely deprecate and remove Headless JS in a future version. We'll open a discussion in the coming months to collect community feedback from it, but the reality is that is not an API we'd recommend. We're not using it internally at Meta, and it's backed by an Android The alternative would be to update Headless JS API to depend on |
Description
After going through the implementation, HeadlessJS is poorly advertised. By its name sake, one would expect "Headless" and "Background" to be synonmous. That doesn't appear to be the case:
#15915
#27835
#43950
#36493
Headless JS tasks have to be started from the Main UI thread, and when the app is put in the background (but left running) the tasks stop. This is next to useless, I could always have asyncrously scheduled my jobs in the main JS conext while the app was forgrounded. The very existence of the "Crash in foreground" being the default suggests this isn't going to be considered.
The documentation was very rough and I had to cobble together various open source repos that demonstrate using it.
How is one expected to make a real background service using Headless JS? Is there any future to this code, or has it gone stale?
Steps to reproduce
React Native Version
0.73.6
Affected Platforms
Runtime - Android
Output of
npx react-native info
Stacktrace or Logs
Reproducer
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: