mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Implemented thread control for exported methods
This commit is contained in:
@@ -109,8 +109,7 @@ typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, RCTSparseArray *v
|
||||
* within the view or shadowView.
|
||||
*/
|
||||
#define RCT_REMAP_VIEW_PROPERTY(name, keyPath, type) \
|
||||
RCT_EXPORT_VIEW_PROP_CONFIG(name, type) \
|
||||
- (void)set_##name:(id)json forView:(id)view withDefaultView:(id)defaultView { \
|
||||
RCT_CUSTOM_VIEW_PROPERTY(name, type, UIView) { \
|
||||
if ((json && !RCTSetProperty(view, @#keyPath, @selector(type:), json)) || \
|
||||
(!json && !RCTCopyProperty(view, defaultView, @#keyPath))) { \
|
||||
RCTLogError(@"%@ does not have setter for `%s` property", [view class], #name); \
|
||||
@@ -118,8 +117,7 @@ RCT_EXPORT_VIEW_PROP_CONFIG(name, type) \
|
||||
}
|
||||
|
||||
#define RCT_REMAP_SHADOW_PROPERTY(name, keyPath, type) \
|
||||
RCT_EXPORT_SHADOW_PROP_CONFIG(name, type) \
|
||||
- (void)set_##name:(id)json forShadowView:(id)view withDefaultView:(id)defaultView { \
|
||||
RCT_CUSTOM_SHADOW_PROPERTY(name, type, RCTShadowView) { \
|
||||
if ((json && !RCTSetProperty(view, @#keyPath, @selector(type:), json)) || \
|
||||
(!json && !RCTCopyProperty(view, defaultView, @#keyPath))) { \
|
||||
RCTLogError(@"%@ does not have setter for `%s` property", [view class], #name); \
|
||||
@@ -132,11 +130,11 @@ RCT_EXPORT_SHADOW_PROP_CONFIG(name, type) \
|
||||
* refer to "json", "view" and "defaultView" to implement the required logic.
|
||||
*/
|
||||
#define RCT_CUSTOM_VIEW_PROPERTY(name, type, viewClass) \
|
||||
RCT_EXPORT_VIEW_PROP_CONFIG(name, type) \
|
||||
+ (NSDictionary *)getPropConfigView_##name { return @{@"name": @#name, @"type": @#type}; } \
|
||||
- (void)set_##name:(id)json forView:(viewClass *)view withDefaultView:(viewClass *)defaultView
|
||||
|
||||
#define RCT_CUSTOM_SHADOW_PROPERTY(name, type, viewClass) \
|
||||
RCT_EXPORT_SHADOW_PROP_CONFIG(name, type) \
|
||||
+ (NSDictionary *)getPropConfigShadow_##name { return @{@"name": @#name, @"type": @#type}; } \
|
||||
- (void)set_##name:(id)json forShadowView:(viewClass *)view withDefaultView:(viewClass *)defaultView
|
||||
|
||||
/**
|
||||
@@ -164,17 +162,4 @@ RCT_EXPORT_SHADOW_PROP_CONFIG(name, type) \
|
||||
[self set_##newName:json forView:view withDefaultView:defaultView]; \
|
||||
}
|
||||
|
||||
/**
|
||||
* PROP_CONFIG macros should only be paired with property setters.
|
||||
*/
|
||||
#define RCT_EXPORT_VIEW_PROP_CONFIG(name, type) \
|
||||
+ (NSDictionary *)getPropConfigView_##name { \
|
||||
return @{@"name": @#name, @"type": @#type}; \
|
||||
}
|
||||
|
||||
#define RCT_EXPORT_SHADOW_PROP_CONFIG(name, type) \
|
||||
+ (NSDictionary *)getPropConfigShadow_##name { \
|
||||
return @{@"name": @#name, @"type": @#type}; \
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#import "RCTEventDispatcher.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTShadowView.h"
|
||||
#import "RCTUIManager.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "RCTView.h"
|
||||
|
||||
@@ -23,6 +24,11 @@
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (dispatch_queue_t)methodQueue
|
||||
{
|
||||
return [_bridge.uiManager methodQueue];
|
||||
}
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [[RCTView alloc] init];
|
||||
|
||||
Reference in New Issue
Block a user