Skip to content

Commit a7dc505

Browse files
Yury Dymovfacebook-github-bot
authored andcommitted
React Native (#53651)
Summary: Pull Request resolved: #53651 ## Stack We aim to remove +load methods from the codebase to reduce pre-main startup time and to unblock enabling startup optimizations ## Diff Diff removes `+load` API from `RCT_EXPORT_MODULE` macro. It introduces new parameter for `react_native_module_provider` function `eager`, which adds legacy RN modules to newly created socket `REACT_MODULE_EAGER_REGISTRATION_SOCKET`. This socket is invoked right before the RCTBridge is being initialized. Impact: 137 static loaders are removed from the startup path ## RN Changelog: [Internal] Reviewed By: RSNara Differential Revision: D81727845 fbshipit-source-id: 4904499f2e8587717b26579364ed48ffed934774
1 parent 6e011c9 commit a7dc505

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

packages/react-native/React/Base/RCTBridgeModule.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ RCT_EXTERN_C_END
6969
* will be used as the JS module name. If omitted, the JS module name will
7070
* match the Objective-C class name.
7171
*/
72+
#ifndef RCT_FIT_RM_OLD_RUNTIME
7273
#define RCT_EXPORT_MODULE(js_name) \
7374
RCT_EXTERN void RCTRegisterModule(Class); \
7475
+(NSString *)moduleName \
@@ -80,6 +81,17 @@ RCT_EXTERN_C_END
8081
RCTRegisterModule(self); \
8182
}
8283

84+
#else
85+
86+
#define RCT_EXPORT_MODULE(js_name) \
87+
RCT_EXTERN void RCTRegisterModule(Class); \
88+
+(NSString *)moduleName \
89+
{ \
90+
return @ #js_name; \
91+
}
92+
93+
#endif // RCT_FIT_RM_OLD_RUNTIME
94+
8395
/**
8496
* Same as RCT_EXPORT_MODULE, but uses __attribute__((constructor)) for module
8597
* registration. Useful for registering swift classes that forbids use of load

0 commit comments

Comments
 (0)