Way to register RCT_MODULE in Plugin2.0 instead of +load

Summary:
[RFC] WIP: Way to register RCT_MODULE in Plugin2.0 instead of +load

This seemed like the simplest way to do this to register in the existing
didNotFindModule callback so that we don't have to touch any opensource code.

NOTE: The new version of this fixes the problems with dylibs, but not the -ObjC flag removal. This seems like the right call to avoid users having to implement c-functions to return their classes; instead we used objc_getClass.

Reviewed By: dshahidehpour

Differential Revision: D9112719

fbshipit-source-id: cf8df97d7c443cafa0e06a1e61bdf2612944ed87
This commit is contained in:
Jeff Thomas
2018-09-21 15:42:03 +01:00
committed by Lorenzo Sciandra
parent 8dc8071795
commit 5f85b256cc
3 changed files with 14 additions and 4 deletions
+10
View File
@@ -73,6 +73,16 @@ RCT_EXTERN void RCTRegisterModule(Class); \
+ (NSString *)moduleName { return @#js_name; } \
+ (void)load { RCTRegisterModule(self); }
/**
* To improve startup performance users may want to generate their module lists
* at build time and hook the delegate to merge with the runtime list. This
* macro takes the place of the above for those cases by omitting the +load
* generation.
*
*/
#define RCT_EXPORT_PRE_REGISTERED_MODULE(js_name) \
+ (NSString *)moduleName { return @#js_name; }
// Implemented by RCT_EXPORT_MODULE
+ (NSString *)moduleName;