Skip to content

Commit

Permalink
patch rn
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas committed Jun 18, 2024
1 parent 09c42f2 commit dbcf2b1
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false
newArchEnabled=true

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
Expand Down
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"debounce": "^1.2.0",
"fbjs": "^3.0.0",
"moment": "^2.24.0",
"patch-package": "^8.0.0",
"prop-types": "^15.7.2",
"react": "18.2.0",
"react-native": "0.74.2",
Expand Down
56 changes: 56 additions & 0 deletions example/patches/@react-native+codegen+0.74.84.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
diff --git a/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleH.js b/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleH.js
index aa14054..9e834ec 100644
--- a/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleH.js
+++ b/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleH.js
@@ -205,7 +205,7 @@ function translatePrimitiveJSTypeToCpp(
case 'DoubleTypeAnnotation':
return wrapOptional('double', isRequired);
case 'FloatTypeAnnotation':
- return wrapOptional('double', isRequired);
+ return wrapOptional('float', isRequired);
case 'Int32TypeAnnotation':
return wrapOptional('int', isRequired);
case 'BooleanTypeAnnotation':
diff --git a/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleJavaSpec.js b/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleJavaSpec.js
index 2ac03f7..59fc704 100644
--- a/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleJavaSpec.js
+++ b/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleJavaSpec.js
@@ -263,11 +263,11 @@ function translateFunctionReturnTypeToJavaType(
case 'NumberTypeAnnotation':
return wrapOptional('double', isRequired);
case 'FloatTypeAnnotation':
- return wrapOptional('double', isRequired);
+ return wrapOptional('float', isRequired);
case 'DoubleTypeAnnotation':
return wrapOptional('double', isRequired);
case 'Int32TypeAnnotation':
- return wrapOptional('double', isRequired);
+ return wrapOptional('int', isRequired);
case 'BooleanTypeAnnotation':
return wrapOptional('boolean', isRequired);
case 'EnumDeclaration':
@@ -336,7 +336,7 @@ function getFalsyReturnStatementFromReturnType(
case 'NumberTypeAnnotation':
return nullable ? 'return null;' : 'return 0;';
case 'FloatTypeAnnotation':
- return nullable ? 'return null;' : 'return 0.0;';
+ return nullable ? 'return null;' : 'return 0f;';
case 'DoubleTypeAnnotation':
return nullable ? 'return null;' : 'return 0.0;';
case 'Int32TypeAnnotation':
diff --git a/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleJniCpp.js b/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleJniCpp.js
index 286ad66..f1859b3 100644
--- a/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleJniCpp.js
+++ b/node_modules/@react-native/codegen/lib/generators/modules/GenerateModuleJniCpp.js
@@ -263,9 +263,9 @@ function translateParamTypeToJniType(param, resolveAlias) {
case 'DoubleTypeAnnotation':
return !isRequired ? 'Ljava/lang/Double;' : 'D';
case 'FloatTypeAnnotation':
- return !isRequired ? 'Ljava/lang/Double;' : 'D';
+ return !isRequired ? 'Ljava/lang/Float;' : 'F';
case 'Int32TypeAnnotation':
- return !isRequired ? 'Ljava/lang/Double;' : 'D';
+ return !isRequired ? 'Ljava/lang/Integer;' : 'I';
case 'GenericObjectTypeAnnotation':
return 'Lcom/facebook/react/bridge/ReadableMap;';
case 'ObjectTypeAnnotation':

0 comments on commit dbcf2b1

Please sign in to comment.