mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
d9deee20e7
Summary: ## Context `NativeModuleRegistryBuilder` calls `TurboReactPackage.getNativeModuleIterator()` to access ModuleHolders for all the NativeModules in the `TurboReactPackage`. We then filter out the ModuleHolders that contain `TurboModules`, before using that list to make create the `NativeModuleRegistry`. ## Problem Creating `ModuleHolders` has the side-effect of actually creating the NativeModule if it requires eager initialization. See [ModuleHolder.java](https://fburl.com/diffusion/4avdtio0): ``` class ModuleHolder { // ... public ModuleHolder(ReactModuleInfo moduleInfo, Provider<? extends NativeModule> provider) { mName = moduleInfo.name(); mProvider = provider; mReactModuleInfo = moduleInfo; if (moduleInfo.needsEagerInit()) { mModule = create(); // HERE! } } ``` So, we need to filter out TurboModules before we even create ModuleHolders. Changelog: [Android][Fixed] - Refactor TurboModule filtering in NativeModuleRegistryBuilder Reviewed By: PeteTheHeat, mdvacca Differential Revision: D18814010 fbshipit-source-id: a120d2b619b9280ba70e21d131dccc5a9fc6346d
Building React Native for Android
See the docs on the website.
Running tests
When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see Testing.