Implemented thread control for exported methods

This commit is contained in:
Nick Lockwood
2015-04-18 10:43:20 -07:00
parent 2b9aaac2ff
commit ead0f2e020
23 changed files with 384 additions and 403 deletions

View File

@@ -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

View File

@@ -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];