mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-09 09:12:06 +08:00
Summary: public In the open source React Native implementation, the recommended approach for importing modules is by importing a the `ReactNative` object, which includes all available modules. This is rather inefficient because it ends up initializing all the JS modules, even if you don't use them. This diff switches the properties of the `ReactNative ` object to lazy getter functions, which defers the `require` until the module is actually requested. This doesn't prevent unused modules from being included in the JS bundle, but it will prevent them from being initialized unless/until they are used. Reviewed By: vjeux Differential Revision: D2722993 fb-gh-sync-id: 0e9a2beb3aa6cd087a0592bd59a8f9242040be0c