Skip to content

Commit

Permalink
fix(android): fix headless crash with null ReactContext
Browse files Browse the repository at this point in the history
very tricky to make sure react-native is initialized during
headlessJS startup so you don't beat it in the race to asking
for a ReactContext before it exists

- startup is event-driven so you have to attach listeners
- startup has to run on main thread so you have to post runnables
- multiple tasks may come in while starting up, you must queue / drain
- startup objects / methods differ across react-native new / old arch

get all that right, and you'll have a valid ReactContext, without
dropping any tasks that needed it before react-native was initialized
  • Loading branch information
mikehardy committed Dec 15, 2024
1 parent 77e72bd commit 40c8557
Show file tree
Hide file tree
Showing 3 changed files with 432 additions and 137 deletions.
Loading

0 comments on commit 40c8557

Please sign in to comment.