diff --git a/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm b/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm index 2eb86cb53de..04cf1bf7e93 100644 --- a/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm +++ b/ReactCommon/turbomodule/core/platform/ios/RCTTurboModule.mm @@ -482,48 +482,6 @@ NSInvocation *ObjCTurboModule::getMethodInvocation( if (arg->isBool()) { bool v = arg->getBool(); - /** - * Convert numbers using RCTConvert if possible. - */ - NSString *methodNameNSString = @(methodName.c_str()); - NSString *argumentType = getArgumentTypeName(methodNameNSString, i); - - if (argumentType != nil) { - NSString *rctConvertMethodName = [NSString stringWithFormat:@"%@:", argumentType]; - SEL rctConvertSelector = NSSelectorFromString(rctConvertMethodName); - - if ([RCTConvert respondsToSelector:rctConvertSelector]) { - if (objCArgType == @encode(id)) { - id (*convert)(id, SEL, id) = (__typeof__(convert))objc_msgSend; - id convertedObjCArg = convert([RCTConvert class], rctConvertSelector, [NSNumber numberWithBool:v]); - - [inv setArgument:(void *)&convertedObjCArg atIndex:i + 2]; - if (convertedObjCArg) { - [retainedObjectsForInvocation addObject:convertedObjCArg]; - } - - continue; - } - - /** - * This is necessary because RCTConvert could be responsible for converting BOOLs to - * type aliases of BOOL. - */ - if (objCArgType == @encode(BOOL)) { - BOOL (*convert)(id, SEL, id) = (__typeof__(convert))objc_msgSend; - BOOL convertedObjCArg = convert([RCTConvert class], rctConvertSelector, [NSNumber numberWithBool:v]); - [inv setArgument:(void *)&convertedObjCArg atIndex:i + 2]; - - continue; - } - - throw std::runtime_error( - "Error when invoking TurboModule method " + name_ + "." + methodName + "(). Could not convert argument " + - std::to_string(i) + " from JS boolean to ObjC type '" + std::to_string(objCArgType[0]) + - "'. Supported types are BOOL (\"" + @encode(BOOL) + "\") and object (\"" + @encode(id) + "\")."); - } - } - /** * JS type checking ensures the Objective C argument here is either a BOOL or NSNumber*. */ @@ -541,53 +499,6 @@ NSInvocation *ObjCTurboModule::getMethodInvocation( if (arg->isNumber()) { double v = arg->getNumber(); - /** - * Convert numbers using RCTConvert if possible. - */ - NSString *methodNameNSString = @(methodName.c_str()); - NSString *argumentType = getArgumentTypeName(methodNameNSString, i); - - if (argumentType != nil) { - NSString *rctConvertMethodName = [NSString stringWithFormat:@"%@:", argumentType]; - SEL rctConvertSelector = NSSelectorFromString(rctConvertMethodName); - - if ([RCTConvert respondsToSelector:rctConvertSelector]) { - if (objCArgType == @encode(id)) { - id (*convert)(id, SEL, id) = (__typeof__(convert))objc_msgSend; - id convertedObjCArg = convert([RCTConvert class], rctConvertSelector, [NSNumber numberWithDouble:v]); - - [inv setArgument:(void *)&convertedObjCArg atIndex:i + 2]; - if (convertedObjCArg) { - [retainedObjectsForInvocation addObject:convertedObjCArg]; - } - - continue; - } - - /** - * This is necessary because RCTConvert could be responsible for converting doubles to - * type aliases of double. For example: - * - * Consider the following typedef: - * typedef double NSTimeInterval; - * - * RCTConvert will convert our doubles to NSTimeInterval by dividing them by 1000. - */ - if (objCArgType == @encode(double)) { - double (*convert)(id, SEL, id) = (__typeof__(convert))objc_msgSend; - double convertedObjCArg = convert([RCTConvert class], rctConvertSelector, [NSNumber numberWithDouble:v]); - [inv setArgument:(void *)&convertedObjCArg atIndex:i + 2]; - - continue; - } - - throw std::runtime_error( - "Error when invoking TurboModule method " + name_ + "." + methodName + "(). Could not convert argument " + - std::to_string(i) + " from JS number to ObjC type '" + std::to_string(objCArgType[0]) + - "'. Supported types are double (\"" + @encode(double) + "\") and object (\"" + @encode(id) + "\")."); - } - } - /** * JS type checking ensures the Objective C argument here is either a double or NSNumber*. */