[RN] Use microtasks in the RN renderer based on a global flag defined by RN
Summary
We want to enable the new event loop in React Native (https://github.com/react-native-community/discussions-and-proposals/pull/744) for all users in the new architecture (determined by the use of bridgeless, not by the use of Fabric). In order to leverage that, we need to also set the flag for the React reconciler to use microtasks for scheduling (so we'll execute them at the right time in the new event loop).
This migrates from the previous approach using a dynamic flag (to be used at Meta) with the check of a global set by React Native. The reason for doing this is:
- We still need to determine this dynamically in OSS (based on Bridgeless, not on Fabric).
- We still need the ability to configure the behavior at Meta, and for internal build system reasons we cannot access the flag that enables microtasks in
ReactNativeFeatureFlags.
How did you test this change?
Manually synchronized the changes to React Native and ran all tests for the new architecture on it. Also tested manually.
[!CAUTION] This shouldn't be merged and synchronized to
react-nativeuntil https://github.com/facebook/react-native/pull/43397 is merged
Comparing: dfaed5582550f11b27aae967a8e7084202dd2d90...90c9589798adf5f7109b1ef55fa6a5ac102c63f7
Critical size changes
Includes critical production bundles, as well as any change greater than 2%:
| Name | +/- | Base | Current | +/- gzip | Base gzip | Current gzip |
|---|---|---|---|---|---|---|
| oss-stable/react-dom/cjs/react-dom.production.min.js | = | 177.10 kB | 177.10 kB | = | 55.20 kB | 55.20 kB |
| oss-experimental/react-dom/cjs/react-dom.production.min.js | = | 177.64 kB | 177.64 kB | = | 55.53 kB | 55.53 kB |
| facebook-www/ReactDOM-prod.classic.js | = | 594.34 kB | 594.34 kB | = | 104.96 kB | 104.96 kB |
| facebook-www/ReactDOM-prod.modern.js | = | 577.60 kB | 577.60 kB | = | 102.02 kB | 102.02 kB |
| test_utils/ReactAllWarnings.js | Deleted | 66.60 kB | 0.00 kB | Deleted | 16.28 kB | 0.00 kB |
Significant size changes
Includes any change greater than 0.2%:
Expand to show
| Name | +/- | Base | Current | +/- gzip | Base gzip | Current gzip |
|---|---|---|---|---|---|---|
| test_utils/ReactAllWarnings.js | Deleted | 66.60 kB | 0.00 kB | Deleted | 16.28 kB | 0.00 kB |
Generated by :no_entry_sign: dangerJS against 90c9589798adf5f7109b1ef55fa6a5ac102c63f7