Turbomodule method with Int32 param not bridged correctly #49688
Labels
Issue: Author Provided Repro
This issue can be reproduced in Snack or an attached project.
Needs: Attention
Issues where the author has responded to feedback.
Newer Patch Available
Resolution: PR Submitted
A pull request with a fix has been provided.
Type: New Architecture
Issues and PRs related to new architecture (Fabric/Turbo Modules)
Description
Passing an Int32 as a param to a Turbomodule will result in a wrong encoded NSInteger.
Given a basic spec for a simple TurboModule that takes an Int32 as parameter (from CodegenTypes):
Codegen generates the following ObjC signature for that method:
However in the ObjCTurboModule::setInvocationArg only a BOOL, double or NSNumber seems to be supported. The Int32 value is interpreted as a double and the output of an NSLog
is
My Int32 (ObjC): 4617315517961601024
Where invoking the turboModule on the Javascript side:
outputs:
My Int32 (JS): 5
It looks like ObjCInteropTurboModule is taking into account a wider set of param types.
Steps to reproduce
Using the snippets above a basic setup of a Turbomodule can be made
Calling NativeTestModule.setMyInt32(5);
Will result in a bridged output of
My Int32 (ObjC): 4617315517961601024
React Native Version
0.76.5
Affected Platforms
Runtime - iOS
Areas
TurboModule - The New Native Module System
Output of
npx @react-native-community/cli info
Stacktrace or Logs
Reproducer
https://github.com/THEOplayer/react-native-theoplayer/tree/bugfix/reproducer-turbomodule-int32
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: