mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +00:00
Mark ObjC methods that are called from React Native as dynamic.
Reviewed By: mmmulani Differential Revision: D7087100 fbshipit-source-id: 18e5726e5b48e7b71fcaab19f6fe73be0cad6233
This commit is contained in:
parent
3eee96ab86
commit
ebbd4371c9
@ -185,7 +185,7 @@ RCT_EXTERN void RCTRegisterModule(Class); \
|
||||
*/
|
||||
#define RCT_REMAP_METHOD(js_name, method) \
|
||||
_RCT_EXTERN_REMAP_METHOD(js_name, method, NO) \
|
||||
- (void)method;
|
||||
- (void)method RCT_DYNAMIC;
|
||||
|
||||
/**
|
||||
* Similar to RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD but lets you set
|
||||
|
@ -177,7 +177,7 @@ RCT_CUSTOM_CONVERTER(type, name, [json getter])
|
||||
* This macro is used for creating converter functions with arbitrary logic.
|
||||
*/
|
||||
#define RCT_CUSTOM_CONVERTER(type, name, code) \
|
||||
+ (type)name:(id)json \
|
||||
+ (type)name:(id)json RCT_DYNAMIC \
|
||||
{ \
|
||||
if (!RCT_DEBUG) { \
|
||||
return code; \
|
||||
@ -216,7 +216,7 @@ RCT_CUSTOM_CONVERTER(type, type, [RCT_DEBUG ? [self NSNumber:json] : json getter
|
||||
* This macro is used for creating converters for enum types.
|
||||
*/
|
||||
#define RCT_ENUM_CONVERTER(type, values, default, getter) \
|
||||
+ (type)type:(id)json \
|
||||
+ (type)type:(id)json RCT_DYNAMIC \
|
||||
{ \
|
||||
static NSDictionary *mapping; \
|
||||
static dispatch_once_t onceToken; \
|
||||
@ -231,7 +231,7 @@ RCT_CUSTOM_CONVERTER(type, type, [RCT_DEBUG ? [self NSNumber:json] : json getter
|
||||
* multiple enum values combined with | operator
|
||||
*/
|
||||
#define RCT_MULTI_ENUM_CONVERTER(type, values, default, getter) \
|
||||
+ (type)type:(id)json \
|
||||
+ (type)type:(id)json RCT_DYNAMIC \
|
||||
{ \
|
||||
static NSDictionary *mapping; \
|
||||
static dispatch_once_t onceToken; \
|
||||
@ -246,7 +246,7 @@ RCT_CUSTOM_CONVERTER(type, type, [RCT_DEBUG ? [self NSNumber:json] : json getter
|
||||
* for typed arrays.
|
||||
*/
|
||||
#define RCT_ARRAY_CONVERTER_NAMED(type, name) \
|
||||
+ (NSArray<type *> *)name##Array:(id)json \
|
||||
+ (NSArray<type *> *)name##Array:(id)json RCT_DYNAMIC \
|
||||
{ \
|
||||
return RCTConvertArrayValue(@selector(name:), json); \
|
||||
}
|
||||
|
@ -104,6 +104,17 @@
|
||||
#define RCT_CONCAT2(A, B) A ## B
|
||||
#define RCT_CONCAT(A, B) RCT_CONCAT2(A, B)
|
||||
|
||||
/**
|
||||
* This attribute is used for static analysis.
|
||||
*/
|
||||
#if !defined RCT_DYNAMIC
|
||||
#if __has_attribute(objc_dynamic)
|
||||
#define RCT_DYNAMIC __attribute__((objc_dynamic))
|
||||
#else
|
||||
#define RCT_DYNAMIC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Throw an assertion for unimplemented methods.
|
||||
*/
|
||||
|
@ -65,13 +65,13 @@ typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, NSDictionary<NSNu
|
||||
* This handles the simple case, where JS and native property names match.
|
||||
*/
|
||||
#define RCT_EXPORT_VIEW_PROPERTY(name, type) \
|
||||
+ (NSArray<NSString *> *)propConfig_##name { return @[@#type]; }
|
||||
+ (NSArray<NSString *> *)propConfig_##name RCT_DYNAMIC { return @[@#type]; }
|
||||
|
||||
/**
|
||||
* This macro maps a named property to an arbitrary key path in the view.
|
||||
*/
|
||||
#define RCT_REMAP_VIEW_PROPERTY(name, keyPath, type) \
|
||||
+ (NSArray<NSString *> *)propConfig_##name { return @[@#type, @#keyPath]; }
|
||||
+ (NSArray<NSString *> *)propConfig_##name RCT_DYNAMIC { return @[@#type, @#keyPath]; }
|
||||
|
||||
/**
|
||||
* This macro can be used when you need to provide custom logic for setting
|
||||
@ -80,19 +80,19 @@ typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, NSDictionary<NSNu
|
||||
*/
|
||||
#define RCT_CUSTOM_VIEW_PROPERTY(name, type, viewClass) \
|
||||
RCT_REMAP_VIEW_PROPERTY(name, __custom__, type) \
|
||||
- (void)set_##name:(id)json forView:(viewClass *)view withDefaultView:(viewClass *)defaultView
|
||||
- (void)set_##name:(id)json forView:(viewClass *)view withDefaultView:(viewClass *)defaultView RCT_DYNAMIC
|
||||
|
||||
/**
|
||||
* This macro is used to map properties to the shadow view, instead of the view.
|
||||
*/
|
||||
#define RCT_EXPORT_SHADOW_PROPERTY(name, type) \
|
||||
+ (NSArray<NSString *> *)propConfigShadow_##name { return @[@#type]; }
|
||||
+ (NSArray<NSString *> *)propConfigShadow_##name RCT_DYNAMIC { return @[@#type]; }
|
||||
|
||||
/**
|
||||
* This macro maps a named property to an arbitrary key path in the shadow view.
|
||||
*/
|
||||
#define RCT_REMAP_SHADOW_PROPERTY(name, keyPath, type) \
|
||||
+ (NSArray<NSString *> *)propConfigShadow_##name { return @[@#type, @#keyPath]; }
|
||||
+ (NSArray<NSString *> *)propConfigShadow_##name RCT_DYNAMIC { return @[@#type, @#keyPath]; }
|
||||
|
||||
/**
|
||||
* This macro can be used when you need to provide custom logic for setting
|
||||
@ -101,6 +101,6 @@ RCT_REMAP_VIEW_PROPERTY(name, __custom__, type) \
|
||||
*/
|
||||
#define RCT_CUSTOM_SHADOW_PROPERTY(name, type, viewClass) \
|
||||
RCT_REMAP_SHADOW_PROPERTY(name, __custom__, type) \
|
||||
- (void)set_##name:(id)json forShadowView:(viewClass *)view
|
||||
- (void)set_##name:(id)json forShadowView:(viewClass *)view RCT_DYNAMIC
|
||||
|
||||
@end
|
||||
|
Loading…
x
Reference in New Issue
Block a user