mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50040 This diff implements main queue module setup. Sometimes, people need to capture uikit things, and use them from javascript. In those cases, people can write main queue modules. These modules will be eagerly initialized on the main queue, during react native init. ## On Necessity **Sync** dispatches to the main thread from the js thread can deadlock react native. And **async** dispatches to the main thread from the js thread sometimes might not be enough: it could lead to flickery rendering. So, we need to allow people to capture ui thread things, before any js executes. ## Caveat This api is dangerous and discouraged. All react native surfaces will pay the cost of one surface introducing a main queue module. It could also slow down common/critical interactions in your app, if you're not careful. We will introduce performance logging for this infrastructure. So that we can monitor and file tasks, when main queue module init starts taking "too long." Changelog: [General][Breaking]: Introduce beforeload callback arg into ReactInstance::loadScript Reviewed By: mdvacca Differential Revision: D71084243 fbshipit-source-id: 8fdb84761ac69468afc428f4f79eff6322449e3c