diff --git a/React/Base/RCTConvert.h b/React/Base/RCTConvert.h index a799d72863e84d..e27ae4699ce26a 100644 --- a/React/Base/RCTConvert.h +++ b/React/Base/RCTConvert.h @@ -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. diff --git a/React/Base/RCTConvert.m b/React/Base/RCTConvert.m index 759c577c74d75f..741830f1224409 100644 --- a/React/Base/RCTConvert.m +++ b/React/Base/RCTConvert.m @@ -534,12 +534,6 @@ + (YGValue)YGValue:(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) diff --git a/React/Base/RCTModuleMethod.mm b/React/Base/RCTModuleMethod.mm index c26ef1c280088d..78d7e5d9945752 100644 --- a/React/Base/RCTModuleMethod.mm +++ b/React/Base/RCTModuleMethod.mm @@ -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 @@ - (void)processMethodSignature 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 diff --git a/React/Views/RCTComponentData.m b/React/Views/RCTComponentData.m index 44bde138c4859d..436091a135368e 100644 --- a/React/Views/RCTComponentData.m +++ b/React/Views/RCTComponentData.m @@ -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 view, id json); typedef NSMutableDictionary 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 _defaultView; // Only needed for RCT_CUSTOM_VIEW_PROPERTY @@ -196,7 +207,7 @@ - (RCTPropBlock)createPropBlock:(NSString *)name isShadowView:(BOOL)isShadowView SEL selector = NSSelectorFromString([NSString stringWithFormat:@"propConfig%@_%@", isShadowView ? @"Shadow" : @"", name]); if ([_managerClass respondsToSelector:selector]) { NSArray *typeAndKeyPath = ((NSArray *(*)(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) {};