From fa6d5ca5721c4e5848a512e82cce05434d8531b8 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Thu, 27 Feb 2025 07:23:10 -0800 Subject: [PATCH] Fabric: Fixes TurboModule method parameter Int32 type not work (#49710) Summary: Fixes https://github.com/facebook/react-native/issues/49688 . ## Changelog: [IOS] [FIXED] - Fabric: Fixes TurboModule method parameter Int32 type not work Pull Request resolved: https://github.com/facebook/react-native/pull/49710 Test Plan: Repro please see https://github.com/facebook/react-native/issues/49688. Reviewed By: cortinico Differential Revision: D70314804 Pulled By: cipolleschi fbshipit-source-id: 4f305b14bb735bd343ef7477b969df237418615d --- .../core/platform/ios/ReactCommon/RCTTurboModule.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm index fe9f1539424..97c9a351bf9 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +++ b/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm @@ -592,12 +592,15 @@ void ObjCTurboModule::setInvocationArg( double v = arg.getNumber(); /** - * JS type checking ensures the Objective C argument here is either a double or NSNumber*. + * JS type checking ensures the Objective C argument here is either a double or NSNumber* or NSInteger. */ if (objCArgType == @encode(id)) { id objCArg = [NSNumber numberWithDouble:v]; [inv setArgument:(void *)&objCArg atIndex:i + 2]; [retainedObjectsForInvocation addObject:objCArg]; + } else if (objCArgType == @encode(NSInteger)) { + NSInteger integer = v; + [inv setArgument:&integer atIndex:i + 2]; } else { [inv setArgument:(void *)&v atIndex:i + 2]; }