Move RCTConvertSelectorForType to their respective using modules
Reviewed By: javache Differential Revision: D6137419 fbshipit-source-id: a30193469e7a061331d3d6798324475890c75625
This commit is contained in:
parent
c0fea385d8
commit
bbc90b4dc2
|
@ -159,11 +159,6 @@ RCT_EXTERN NSNumber *RCTConvertEnumValue(const char *, NSDictionary *, NSNumber
|
|||
RCT_EXTERN NSNumber *RCTConvertMultiEnumValue(const char *, NSDictionary *, NSNumber *, id);
|
||||
RCT_EXTERN NSArray *RCTConvertArrayValue(SEL, id);
|
||||
|
||||
/**
|
||||
* Get the converter function for the specified type
|
||||
*/
|
||||
RCT_EXTERN SEL RCTConvertSelectorForType(NSString *type);
|
||||
|
||||
/**
|
||||
* This macro is used for logging conversion errors. This is just used to
|
||||
* avoid repeating the same boilerplate for every error message.
|
||||
|
|
|
@ -534,12 +534,6 @@ NSArray *RCTConvertArrayValue(SEL type, id json)
|
|||
return values;
|
||||
}
|
||||
|
||||
SEL RCTConvertSelectorForType(NSString *type)
|
||||
{
|
||||
const char *input = type.UTF8String;
|
||||
return NSSelectorFromString([RCTParseType(&input) stringByAppendingString:@":"]);
|
||||
}
|
||||
|
||||
RCT_ARRAY_CONVERTER(NSURL)
|
||||
RCT_ARRAY_CONVERTER(RCTFileURL)
|
||||
RCT_ARRAY_CONVERTER(UIColor)
|
||||
|
|
|
@ -24,6 +24,15 @@
|
|||
|
||||
typedef BOOL (^RCTArgumentBlock)(RCTBridge *, NSUInteger, id);
|
||||
|
||||
/**
|
||||
* Get the converter function for the specified type
|
||||
*/
|
||||
static SEL selectorForType(NSString *type)
|
||||
{
|
||||
const char *input = type.UTF8String;
|
||||
return NSSelectorFromString([RCTParseType(&input) stringByAppendingString:@":"]);
|
||||
}
|
||||
|
||||
@implementation RCTMethodArgument
|
||||
|
||||
- (instancetype)initWithType:(NSString *)type
|
||||
|
@ -257,7 +266,7 @@ RCT_EXTERN_C_END
|
|||
BOOL isNullableType = NO;
|
||||
RCTMethodArgument *argument = arguments[i - 2];
|
||||
NSString *typeName = argument.type;
|
||||
SEL selector = RCTConvertSelectorForType(typeName);
|
||||
SEL selector = selectorForType(typeName);
|
||||
if ([RCTConvert respondsToSelector:selector]) {
|
||||
switch (objcType[0]) {
|
||||
// Primitives
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#import "RCTBridge.h"
|
||||
#import "RCTBridgeModule.h"
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTParserUtils.h"
|
||||
#import "RCTShadowView.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "UIView+React.h"
|
||||
|
@ -21,6 +22,16 @@
|
|||
typedef void (^RCTPropBlock)(id<RCTComponent> view, id json);
|
||||
typedef NSMutableDictionary<NSString *, RCTPropBlock> RCTPropBlockDictionary;
|
||||
|
||||
/**
|
||||
* Get the converter function for the specified type
|
||||
*/
|
||||
static SEL selectorForType(NSString *type)
|
||||
{
|
||||
const char *input = type.UTF8String;
|
||||
return NSSelectorFromString([RCTParseType(&input) stringByAppendingString:@":"]);
|
||||
}
|
||||
|
||||
|
||||
@implementation RCTComponentData
|
||||
{
|
||||
id<RCTComponent> _defaultView; // Only needed for RCT_CUSTOM_VIEW_PROPERTY
|
||||
|
@ -196,7 +207,7 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
|||
SEL selector = NSSelectorFromString([NSString stringWithFormat:@"propConfig%@_%@", isShadowView ? @"Shadow" : @"", name]);
|
||||
if ([_managerClass respondsToSelector:selector]) {
|
||||
NSArray<NSString *> *typeAndKeyPath = ((NSArray<NSString *> *(*)(id, SEL))objc_msgSend)(_managerClass, selector);
|
||||
type = RCTConvertSelectorForType(typeAndKeyPath[0]);
|
||||
type = selectorForType(typeAndKeyPath[0]);
|
||||
keyPath = typeAndKeyPath.count > 1 ? typeAndKeyPath[1] : nil;
|
||||
} else {
|
||||
return ^(__unused id view, __unused id json) {};
|
||||
|
|
Loading…
Reference in New Issue