-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codegen - 0.74: Int32 | null generates Nullable Integer on java side, but Ljava/lang/Double on c++ side. #44963
Comments
|
Is this a regression from 0.73 to 0.74 @mfazekas ? |
@cortinico yes I believe so. At least the error - But looking at the sources this part was not touched in 4 years. Also in 0.73.0 I also see double
So not sure why we started to face the issue now. |
@mfazekas Could we get a small repro using https://github.com/react-native-community/reproducer-react-native ? That would make it way easier for me to understand what happened. |
@cortinico sure will try to do that |
@cortinico so the issue is that in RN 0.73 public abstract void setHandledMapChangedEvents(@Nullable Double viewRef, ReadableArray events, Promise promise); while RN 0.74 it's changed to: - public abstract void setHandledMapChangedEvents(@Nullable Double viewRef, ReadableArray events, Promise promise);
+ public abstract void setHandledMapChangedEvents(@Nullable Integer viewRef, ReadableArray events, Promise promise); But rest of RN 0.74 has not made this change. react-native/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js Lines 262 to 263 in 9922628
|
As for if it's a breaking change? I'm not 100% sure many modules like |
Summary: Users reported that Int32 types in codegen are causing a crash in 0.74. Fixes facebook#44963 This is because of D52420921 which partially implemented type change for Int32/Float. Here I'm fixing it by adding propery return types and bytecode signatures for Int32/Float. Changelog: [Android] [Fixed] - Fix codegen support for Int32/Float Reviewed By: dmytrorykun Differential Revision: D58725243
This is indeed a bug. Fix for it is here: @mfazekas if you could try it with patch-package and report back, would be gold. We could include it in the next 0.74 patch release. |
Summary: Pull Request resolved: facebook#45024 Users reported that Int32 types in codegen are causing a crash in 0.74. Fixes facebook#44963 This is because of D52420921 which partially implemented type change for Int32/Float. Here I'm fixing it by adding propery return types and bytecode signatures for Int32/Float. Changelog: [Android] [Fixed] - Fix codegen support for Int32/Float Reviewed By: dmytrorykun Differential Revision: D58725243
Summary: Pull Request resolved: facebook#45024 Users reported that Int32 types in codegen are causing a crash in 0.74. Fixes facebook#44963 This is because of D52420921 which partially implemented type change for Int32/Float. Here I'm fixing it by adding propery return types and bytecode signatures for Int32/Float. Changelog: [Android] [Fixed] - Fix codegen support for Int32/Float Differential Revision: D58725243
@cortinico Note that this fix, while looks great and is correct. Can actually cause issues in some case - like, the mentioned react-native-svg has the spec generated with 0.73 or even older, so it might work because of the current but, but with next 0.74.* release they'll need to update those generated java code: https://github.com/software-mansion/react-native-svg/blob/main/android/src/paper/java/com/horcrux/svg/NativeSvgRenderableModuleSpec.java |
Great thanks for the confirmation 👍
We're aware of this. That's why this change was marked as breaking + started from last version we added support for
That will allow libraries to ship the generated code so that mismatch between codegen versions like this one won't happen again |
Ok so for React Native SVG the fix would be here: @mfazekas have you noticed any similar failures? |
…ok#45024) Summary: Original commit changeset: 32b3bbdf5fd2 Fixes facebook#44963 Closes facebook#45024 Original Phabricator Diff: D52420921 Reviewed By: dmytrorykun Differential Revision: D58820544
We ended up reverting the partial Int32/Float implementation, as attempting to fix it with the previous PR I linked would create more problems with libraries like We'll get back to it in a future release. |
Summary: Pull Request resolved: #45087 Original commit changeset: 32b3bbdf5fd2 Fixes #44963 Closes #45024 Original Phabricator Diff: D52420921 Changelog: [Internal] [Changed] - Back out "[RN][Codegen]Add Float and Int type support for Android modules" Reviewed By: dmytrorykun Differential Revision: D58820544 fbshipit-source-id: 59cd0e7cc17a681785c57b5ce1a9d50d28a348af
Summary: Pull Request resolved: #45087 Original commit changeset: 32b3bbdf5fd2 Fixes #44963 Closes #45024 Original Phabricator Diff: D52420921 Changelog: [Internal] [Changed] - Back out "[RN][Codegen]Add Float and Int type support for Android modules" Reviewed By: dmytrorykun Differential Revision: D58820544 fbshipit-source-id: 59cd0e7cc17a681785c57b5ce1a9d50d28a348af
Description
In RN 0.74 we started to see
Error: Exception in HostFunction: no non-static method "Lcom/rnmapbox/rnmbx/components/mapview/NativeMapViewModule;.setHandledMapChangedEvents(Ljava/lang/Double;Lcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/Promise;)V
We implement the function as
Codespec: Int32
Our maps/src/specs/NativeMapViewModule.ts has:
specs-generated.cpp: java.lang.Double
Codegen generated cpp:
android/build/generated/source/codegen/jni/rnmapbox_maps_specs-generated.cpp
hasLjava/lang/Double
ModuleSpec.java: java.lang.Integer
Codegen generate-specs-cli.js generated maps/android/src/main/old-arch/com/rnmapbox/rnmbx/NativeMapViewModuleSpec.java has as:
See rnmapbox/maps#3527
Steps to reproduce
1.) check out the main branch of the
rnmapbox/maps
repository2.) install modules
3.) change
newArchEnabled
tonewArchEnabled=true
inexample/android/gradle.properties
4.) Build the project
Check the files mentioned in description
React Native Version
0.74.2
Affected Platforms
Runtime - Android
Areas
TurboModule - The New Native Module System, Codegen
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/rnmapbox/maps
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: