diff --git a/package.json b/package.json index 216e376dc82..35ed0479889 100644 --- a/package.json +++ b/package.json @@ -176,7 +176,7 @@ "react-native-responsive-screen": "^1.4.1", "react-native-safe-area-context": "^3.3.2", "react-native-screen-brightness": "^2.0.0-alpha", - "react-native-screens": "^3.30.1", + "react-native-screens": "3.30.1", "react-native-sha256": "1.2.3", "react-native-share": "7.3.9", "react-native-splash-screen": "^3.2.0", diff --git a/patches/patches.md b/patches/patches.md index 7eb5ebc50c1..0d4d7a45e25 100644 --- a/patches/patches.md +++ b/patches/patches.md @@ -172,4 +172,12 @@ Created on **16/01/2023** - This patch fixes a crash on Android devices when trying to find/create/remove calendar events. An Event has an Id property which type may be a long but the library deals only with Java's signed int32. This was fine as long as each event was originally created and handled using this library only but - initially another library was used, react-native-add-calendar-event, which treated event's Id as long \ No newline at end of file + initially another library was used, react-native-add-calendar-event, which treated event's Id as long + +### react-native-screens+3.30.1.patch + +Created on **12/04/2024** + +#### Reason: + +- This patch fixes an issue introduced by the library update that return an error during the build of the app on android device. The issue has been fixed in the release of the library `3.31.0` but it's still on a pre-release stage. We are waiting for the release of the library to remove the patch. \ No newline at end of file diff --git a/patches/react-native-screens+3.30.1.patch b/patches/react-native-screens+3.30.1.patch new file mode 100644 index 00000000000..04b2c4fd925 --- /dev/null +++ b/patches/react-native-screens+3.30.1.patch @@ -0,0 +1,138 @@ +diff --git a/node_modules/react-native-screens/android/build.gradle b/node_modules/react-native-screens/android/build.gradle +index c2ecc16..6c20ed2 100644 +--- a/node_modules/react-native-screens/android/build.gradle ++++ b/node_modules/react-native-screens/android/build.gradle +@@ -46,6 +46,38 @@ def reactNativeArchitectures() { + return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] + } + ++def safeAppExtGet(prop, fallback) { ++ def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') } ++ appProject?.ext?.has(prop) ? appProject.ext.get(prop) : fallback ++} ++ ++def resolveReactNativeDirectory() { ++ def reactNativeLocation = safeAppExtGet("REACT_NATIVE_NODE_MODULES_DIR", null) ++ if (reactNativeLocation != null) { ++ return file(reactNativeLocation) ++ } ++ ++ def reactNativeFromAppNodeModules = file("${projectDir}/../../react-native") ++ if (reactNativeFromAppNodeModules.exists()) { ++ return reactNativeFromAppNodeModules ++ } ++ ++ def reactNativeFromProjectNodeModules = file("${rootProject.projectDir}/../node_modules/react-native") ++ if (reactNativeFromProjectNodeModules.exists()) { ++ return reactNativeFromProjectNodeModules ++ } ++ ++ throw new GradleException( ++ "[RNScreens] Unable to resolve react-native location in node_modules. You should project extension property (in `app/build.gradle`) `REACT_NATIVE_NODE_MODULES_DIR` with path to react-native." ++ ) ++} ++ ++def reactNativeRootDir = resolveReactNativeDirectory() ++def reactProperties = new Properties() ++file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) } ++def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME") ++def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger() ++ + android { + compileSdkVersion safeExtGet('compileSdkVersion', rnsDefaultCompileSdkVersion) + def agpVersion = Version.ANDROID_GRADLE_PLUGIN_VERSION +@@ -80,12 +112,14 @@ android { + } + } + } +- buildFeatures { +- prefab true +- } +- externalNativeBuild { +- cmake { +- path "CMakeLists.txt" ++ if (REACT_NATIVE_MINOR_VERSION >= 71) { ++ buildFeatures { ++ prefab true ++ } ++ externalNativeBuild { ++ cmake { ++ path "CMakeLists.txt" ++ } + } + } + lintOptions { +@@ -146,11 +180,11 @@ repositories { + + dependencies { + implementation 'com.facebook.react:react-native:+' +- implementation 'androidx.appcompat:appcompat:1.5.0' ++ implementation 'androidx.appcompat:appcompat:1.4.2' + implementation 'androidx.fragment:fragment:1.3.6' + implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0' + implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' +- implementation 'com.google.android.material:material:1.9.0' ++ implementation 'com.google.android.material:material:1.6.1' + implementation "androidx.core:core-ktx:1.8.0" + + constraints { +diff --git a/node_modules/react-native-screens/gesture-handler/package.json b/node_modules/react-native-screens/gesture-handler/package.json +index 282b21b..3b244ad 100644 +--- a/node_modules/react-native-screens/gesture-handler/package.json ++++ b/node_modules/react-native-screens/gesture-handler/package.json +@@ -1,6 +1,13 @@ + { + "main": "../lib/commonjs/gesture-handler/index", + "module": "../lib/module/gesture-handler/index", +- "react-native": "../src/gesture-handler/index", +- "types": "../lib/typescript/gesture-handler/index" ++ "react-native": { ++ "../lib/commonjs/gesture-handler/index": "../src/gesture-handler/index", ++ "path": "path-browserify" ++ }, ++ "types": "../lib/typescript/gesture-handler/index", ++ "browser": { ++ "../lib/commonjs/gesture-handler/index": "../src/gesture-handler/index", ++ "path": "path-browserify" ++ } + } +diff --git a/node_modules/react-native-screens/native-stack/package.json b/node_modules/react-native-screens/native-stack/package.json +index 6d82f6a..08ee459 100644 +--- a/node_modules/react-native-screens/native-stack/package.json ++++ b/node_modules/react-native-screens/native-stack/package.json +@@ -1,6 +1,13 @@ + { + "main": "../lib/commonjs/native-stack/index", + "module": "../lib/module/native-stack/index", +- "react-native": "../src/native-stack/index", +- "types": "../lib/typescript/native-stack/index.d.ts" ++ "react-native": { ++ "../lib/commonjs/native-stack/index": "../src/native-stack/index", ++ "path": "path-browserify" ++ }, ++ "types": "../lib/typescript/native-stack/index.d.ts", ++ "browser": { ++ "../lib/commonjs/native-stack/index": "../src/native-stack/index", ++ "path": "path-browserify" ++ } + } +diff --git a/node_modules/react-native-screens/reanimated/package.json b/node_modules/react-native-screens/reanimated/package.json +index 55fece0..9d97835 100644 +--- a/node_modules/react-native-screens/reanimated/package.json ++++ b/node_modules/react-native-screens/reanimated/package.json +@@ -1,6 +1,13 @@ + { + "main": "../lib/commonjs/reanimated/index", + "module": "../lib/module/reanimated/index", +- "react-native": "../src/reanimated/index", +- "types": "../lib/typescript/reanimated/index.d.ts" ++ "react-native": { ++ "../lib/commonjs/reanimated/index": "../src/reanimated/index", ++ "path": "path-browserify" ++ }, ++ "types": "../lib/typescript/reanimated/index.d.ts", ++ "browser": { ++ "../lib/commonjs/reanimated/index": "../src/reanimated/index", ++ "path": "path-browserify" ++ } + } diff --git a/yarn.lock b/yarn.lock index 5de79e0212f..6c2f53e3846 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14706,7 +14706,7 @@ react-native-screen-brightness@^2.0.0-alpha: resolved "https://registry.yarnpkg.com/react-native-screen-brightness/-/react-native-screen-brightness-2.0.0-alpha.tgz#2fc30cf711cfafa5e0aec685f0fce51ce65e0052" integrity sha512-NdJPptcWiFwG9aypm0awYv9d/aoZSJetXPFkx6w/UuNX9SRr5YTKXMSND/2lwuSOw6uGU9mQ0f4dBuGZSNgzow== -react-native-screens@^3.30.1: +react-native-screens@3.30.1: version "3.30.1" resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-3.30.1.tgz#254f5cbbeed649492da112756f85ecae3ccf313e" integrity sha512-/muEvjocCtFb+j5J3YmLvB25+f4rIU8hnnxgGTkXcAf2omPBY8uhPjJaaFUlvj64VEoEzJcRpugbXWsjfPPIFg==