From 208a96dc7c5b0b0444e64b0259aae5c17c70dbe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20=C5=BBelawski?= <40713406+tjzel@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:05:18 +0100 Subject: [PATCH] chore: Align with react-native@0.74 as oldest supported version (#6629) ## Summary https://github.com/facebook/react-native/blob/0.74-stable/gradle/wrapper/gradle-wrapper.properties https://github.com/facebook/react-native/blob/0.74-stable/packages/react-native/gradle/libs.versions.toml ## Test plan ![Screenshot 2024-10-30 at 17 05 16](https://github.com/user-attachments/assets/a8f8f9e2-6a2d-442e-875c-8fbb32a1fbdd) --- .../workflows/example-tvos-build-check.yml | 4 +-- ...reanimated-compatibility-check-nightly.yml | 10 +++--- ...-typescript-compatibility-test-nightly.yml | 2 +- apps/fabric-example/ios/Podfile.lock | 8 ++--- apps/paper-example/ios/Podfile.lock | 4 +-- .../docs/guides/compatibility.mdx | 4 ++- .../RNReanimated.podspec | 12 +++---- .../android/build.gradle | 31 +++++++------------ .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../scripts/reanimated_utils.rb | 18 +++-------- 10 files changed, 37 insertions(+), 58 deletions(-) diff --git a/.github/workflows/example-tvos-build-check.yml b/.github/workflows/example-tvos-build-check.yml index d708cf83770..67a548fcc9f 100644 --- a/.github/workflows/example-tvos-build-check.yml +++ b/.github/workflows/example-tvos-build-check.yml @@ -59,5 +59,5 @@ jobs: bundle exec pod install - name: Build app - working-directory: ${{ env.WORKING_DIRECTORY }} - run: yarn react-native-tvos run-ios --no-packager --scheme TVOSExample-tvOS --simulator "Apple TV" + working-directory: ${{ env.WORKING_DIRECTORY }}/ios + run: xcodebuild -workspace TVOSExample.xcworkspace -configuration Debug -scheme TVOSExample -destination "generic/platform=tvOS Simulator" -quiet diff --git a/.github/workflows/reanimated-compatibility-check-nightly.yml b/.github/workflows/reanimated-compatibility-check-nightly.yml index 1c3b46983a8..8bde71c666e 100644 --- a/.github/workflows/reanimated-compatibility-check-nightly.yml +++ b/.github/workflows/reanimated-compatibility-check-nightly.yml @@ -19,12 +19,12 @@ jobs: # Update it when dropping support for RN versions. react-native: [ - { version: '0.72', architecture: 'Paper' }, - { version: '0.73', architecture: 'Paper' }, { version: '0.74', architecture: 'Paper' }, { version: '0.74', architecture: 'Fabric' }, { version: '0.75', architecture: 'Paper' }, { version: '0.75', architecture: 'Fabric' }, + { version: '0.76', architecture: 'Paper' }, + { version: '0.76', architecture: 'Fabric' }, ] fail-fast: false env: @@ -57,15 +57,15 @@ jobs: - name: Install Pods if: ${{ matrix.platform == 'iOS' }} working-directory: ${{ env.APP_NAME }}/ios - run: bundle install && bundle exec pod install + run: bundle install && bundle exec pod update - name: Setup Fabric (Android) if: ${{ matrix.platform == 'Android' && matrix.react-native.architecture == 'Fabric' }} working-directory: ${{ env.APP_NAME }}/android run: sed -i 's/newArchEnabled=false/newArchEnabled=true/' gradle.properties - name: Build app (iOS) if: ${{ matrix.platform == 'iOS' }} - working-directory: ${{ env.APP_NAME }} - run: yarn react-native run-ios --simulator='iPhone 14' --terminal='Terminal'--mode=${{ matrix.mode }} + working-directory: ${{ env.APP_NAME }}/ios + run: xcodebuild -workspace ${{env.APP_NAME}}.xcworkspace -configuration ${{matrix.mode}} -scheme ${{env.APP_NAME}} -destination "generic/platform=iOS Simulator" -quiet - name: Build app (Android) if: ${{ matrix.platform == 'Android' }} working-directory: ${{ env.APP_NAME }}/android diff --git a/.github/workflows/reanimated-typescript-compatibility-test-nightly.yml b/.github/workflows/reanimated-typescript-compatibility-test-nightly.yml index 2cbeb838eee..6a8d3523171 100644 --- a/.github/workflows/reanimated-typescript-compatibility-test-nightly.yml +++ b/.github/workflows/reanimated-typescript-compatibility-test-nightly.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: # TODO: Fetch versions from common source. - react-native-version: ['0.72', '0.73', '0.74', '0.75', nightly] + react-native-version: ['0.74', '0.75', '0.76', nightly] fail-fast: false concurrency: group: TS-react-native-nightly-${{ matrix.react-native-version }}-${{ github.ref }} diff --git a/apps/fabric-example/ios/Podfile.lock b/apps/fabric-example/ios/Podfile.lock index 4f7fa1618c4..434613b03b6 100644 --- a/apps/fabric-example/ios/Podfile.lock +++ b/apps/fabric-example/ios/Podfile.lock @@ -1879,7 +1879,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - RNSVG (15.8.0-rc.1): + - RNSVG (15.8.0): - DoubleConversion - glog - hermes-engine @@ -1899,9 +1899,9 @@ PODS: - ReactCodegen - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - - RNSVG/common (= 15.8.0-rc.1) + - RNSVG/common (= 15.8.0) - Yoga - - RNSVG/common (15.8.0-rc.1): + - RNSVG/common (15.8.0): - DoubleConversion - glog - hermes-engine @@ -2231,7 +2231,7 @@ SPEC CHECKSUMS: RNGestureHandler: fc5ce5bf284640d3af6431c3a5c3bc121e98d045 RNReanimated: 2db902281618797873d75426f334ede4e503baf8 RNScreens: e389d6a6a66a4f0d3662924ecae803073ccce8ec - RNSVG: 08750404f92a36162a92522cc77dee437be1d257 + RNSVG: 536cd3c866c878faf72beaba166c8b02fe2b762b SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 Yoga: db69236006b8b1c6d55ab453390c882306cbf219 diff --git a/apps/paper-example/ios/Podfile.lock b/apps/paper-example/ios/Podfile.lock index 33c9b66b381..b3b68dbb99a 100644 --- a/apps/paper-example/ios/Podfile.lock +++ b/apps/paper-example/ios/Podfile.lock @@ -1710,7 +1710,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - RNSVG (15.8.0-rc.1): + - RNSVG (15.8.0): - React-Core - SocketRocket (0.7.1) - Yoga (0.0.0) @@ -2021,7 +2021,7 @@ SPEC CHECKSUMS: RNGestureHandler: 511250b190a284388f9dd0d2e56c1df76f14cfb8 RNReanimated: 9ef3b1908a15b0b778edd6dacad9c71e7fe9e849 RNScreens: c7ceced6a8384cb9be5e7a5e88e9e714401fd958 - RNSVG: 01eb8d8a0e2289ec3ecc9626ce920e00d2174992 + RNSVG: 8b1a777d54096b8c2a0fd38fc9d5a454332bbb4d SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 Yoga: db69236006b8b1c6d55ab453390c882306cbf219 diff --git a/packages/docs-reanimated/docs/guides/compatibility.mdx b/packages/docs-reanimated/docs/guides/compatibility.mdx index 240edb2c002..b756a9d7b32 100644 --- a/packages/docs-reanimated/docs/guides/compatibility.mdx +++ b/packages/docs-reanimated/docs/guides/compatibility.mdx @@ -11,6 +11,7 @@ sidebar_label: Compatibility | | 0.63 | 0.64 | 0.65 | 0.66 | 0.67 | 0.68 | 0.69 | 0.70 | 0.71 | 0.72 | 0.73 | 0.74 | 0.75 | 0.76 | | ------------------------------------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | +| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | @@ -33,7 +34,7 @@ Reanimated 2 won't receive support for newest React Native versions. To get the ### Supported React Native versions on the New Architecture (Fabric) -To use Reanimated with [the experimental New Architecture](https://reactnative.dev/docs/the-new-architecture/landing-page), update the package to at least version 3.0.0. Due to the vast number of breaking-changes related to the New Architecture in each React Native version, as a rule of thumb Reanimated supports the latest stable version of React Native. +To use Reanimated with [the New Architecture](https://reactnative.dev/docs/the-new-architecture/landing-page), update the package to at least version 3.0.0. Reanimated supports the [bridgeless mode](https://github.com/reactwg/react-native-new-architecture/discussions/154). @@ -41,6 +42,7 @@ Reanimated supports the [bridgeless mode](https://github.com/reactwg/react-nativ | | 0.63 | 0.64 | 0.65 | 0.66 | 0.67 | 0.68 | 0.69 | 0.70 | 0.71 | 0.72 | 0.73 | 0.74 | 0.75 | 0.76 | | ----------------------------------- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ------ | ------ | ------ | ------ | ------ | ------ | +| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diff --git a/packages/react-native-reanimated/RNReanimated.podspec b/packages/react-native-reanimated/RNReanimated.podspec index dbc74033361..d27eaf85978 100644 --- a/packages/react-native-reanimated/RNReanimated.podspec +++ b/packages/react-native-reanimated/RNReanimated.podspec @@ -3,7 +3,6 @@ require_relative './scripts/reanimated_utils' reanimated_package_json = JSON.parse(File.read(File.join(__dir__, "package.json"))) $config = find_config() -assert_latest_react_native_with_new_architecture($config, reanimated_package_json) assert_minimal_react_native_version($config) $new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1' @@ -16,7 +15,7 @@ fabric_flags = $new_arch_enabled ? '-DRCT_NEW_ARCH_ENABLED' : '' example_flag = $config[:is_reanimated_example_app] ? '-DIS_REANIMATED_EXAMPLE_APP' : '' version_flag = "-DREANIMATED_VERSION=#{reanimated_package_json['version']}" debug_flag = is_release ? '-DNDEBUG' : '' -ios_min_version = $config[:react_native_minor_version] >= 73 ? '13.4' : '9.0' +ios_min_version = '13.4' # Directory in which data for further processing for clangd will be stored. compilation_metadata_dir = "CompilationDatabase" @@ -34,9 +33,6 @@ def self.install_modules_dependencies_legacy(s) s.dependency "RCTRequired" s.dependency "RCTTypeSafety" s.dependency 'FBLazyVector' - if $config[:react_native_minor_version] <= 71 - s.dependency 'FBReactNativeSpec' - end s.dependency 'React-Core' s.dependency 'React-CoreModules' s.dependency 'React-Core/DevSupport' @@ -58,12 +54,12 @@ def self.install_modules_dependencies_legacy(s) s.dependency 'Yoga' s.dependency 'DoubleConversion' s.dependency 'glog' - if using_hermes && !$config[:is_tvos_target] && $config[:react_native_minor_version] >= 70 + if using_hermes && !$config[:is_tvos_target] s.dependency 'React-hermes' s.dependency 'hermes-engine' end s.dependency 'React-callinvoker' - if $config[:react_native_minor_version] >= 72 && !$new_arch_enabled + if !$new_arch_enabled s.dependency 'React-RCTAppDelegate' end end @@ -101,7 +97,7 @@ Pod::Spec.new do |s| end gcc_debug_definitions = "$(inherited)" - if $config[:react_native_minor_version] >= 73 || !is_release + if !is_release gcc_debug_definitions << " HERMES_ENABLE_DEBUGGER=1" end diff --git a/packages/react-native-reanimated/android/build.gradle b/packages/react-native-reanimated/android/build.gradle index 612994412a7..fbb956285fb 100644 --- a/packages/react-native-reanimated/android/build.gradle +++ b/packages/react-native-reanimated/android/build.gradle @@ -196,9 +196,9 @@ buildscript { } } dependencies { - classpath "com.android.tools.build:gradle:7.3.1" - classpath "de.undercouch:gradle-download-task:5.0.1" - classpath "com.diffplug.spotless:spotless-plugin-gradle:6.11.0" + classpath "com.android.tools.build:gradle:8.2.1" + classpath "de.undercouch:gradle-download-task:5.6.0" + classpath "com.diffplug.spotless:spotless-plugin-gradle:6.25.0" } } @@ -211,7 +211,7 @@ apply plugin: "maven-publish" apply plugin: "de.undercouch.download" android { - compileSdkVersion safeExtGet("compileSdkVersion", 30) + compileSdkVersion safeExtGet("compileSdkVersion", 34) def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION if (agpVersion.tokenize('.')[0].toInteger() >= 7) { @@ -241,8 +241,8 @@ android { } defaultConfig { - minSdkVersion safeExtGet("minSdkVersion", 16) - targetSdkVersion safeExtGet("targetSdkVersion", 30) + minSdkVersion safeExtGet("minSdkVersion", 23) + targetSdkVersion safeExtGet("targetSdkVersion", 34) versionCode 1 versionName "1.0" buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", IS_NEW_ARCHITECTURE_ENABLED.toString()) @@ -435,21 +435,12 @@ android { } } -def assertLatestReactNativeWithNewArchitecture = task assertLatestReactNativeWithNewArchitectureTask { - onlyIf { IS_NEW_ARCHITECTURE_ENABLED && REANIMATED_MAJOR_VERSION == 3 && REACT_NATIVE_MINOR_VERSION < 74 } - doFirst { - // If you change the minimal React Native version remember to update Compatibility Table in docs - throw new GradleException( - "[Reanimated] Outdated version of React Native for New Architecture. Reanimated " + REANIMATED_VERSION + " supports the New Architecture on React Native 0.74.0+. See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#outdated-version-of-react-native-for-new-architecture for more information." - ) - } -} - def assertMinimalReactNativeVersion = task assertMinimalReactNativeVersionTask { - onlyIf { REACT_NATIVE_MINOR_VERSION < 71 } + // If you change the minimal React Native version remember to update Compatibility Table in docs + def minimalReactNativeVersion = 74 + onlyIf { REACT_NATIVE_MINOR_VERSION < minimalReactNativeVersion } doFirst { - // If you change the minimal React Native version remember to update Compatibility Table in docs - throw new GradleException("[Reanimated] Unsupported React Native version. Please use 0.71 or newer.") + throw new GradleException("[Reanimated] Unsupported React Native version. Please use $minimalReactNativeVersion. or newer.") } } @@ -468,7 +459,7 @@ task prepareReanimatedHeadersForPrefabs(type: Copy) { } tasks.preBuild { - dependsOn assertLatestReactNativeWithNewArchitecture, assertMinimalReactNativeVersion + dependsOn assertMinimalReactNativeVersion } task cleanCmakeCache() { diff --git a/packages/react-native-reanimated/android/gradle/wrapper/gradle-wrapper.properties b/packages/react-native-reanimated/android/gradle/wrapper/gradle-wrapper.properties index 8fad3f5a98b..510e4efae0b 100644 --- a/packages/react-native-reanimated/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/react-native-reanimated/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/packages/react-native-reanimated/scripts/reanimated_utils.rb b/packages/react-native-reanimated/scripts/reanimated_utils.rb index 9fc7b15b617..aff6bbb3ffe 100644 --- a/packages/react-native-reanimated/scripts/reanimated_utils.rb +++ b/packages/react-native-reanimated/scripts/reanimated_utils.rb @@ -51,20 +51,10 @@ def find_config() return result end -def assert_latest_react_native_with_new_architecture(config, reanimated_package_json) - reanimated_version = reanimated_package_json['version'] - reanimated_major_version = reanimated_version.split('.')[0].to_i - react_native_minor_version = config[:react_native_minor_version] - fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1' - if fabric_enabled && reanimated_major_version == 3 && react_native_minor_version < 74 - # If you change the minimal React Native version remember to update Compatibility Table in docs - raise "[Reanimated] Outdated version of React Native for New Architecture. Reanimated " + reanimated_version + " supports the New Architecture on React Native 0.74.0+. See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#outdated-version-of-react-native-for-new-architecture for more information." - end -end - def assert_minimal_react_native_version(config) - if config[:react_native_minor_version] < 71 - # If you change the minimal React Native version remember to update Compatibility Table in docs - raise "[Reanimated] Unsupported React Native version. Please use 0.71 or newer." + # If you change the minimal React Native version remember to update Compatibility Table in docs + minimalReactNativeVersion = 74 + if config[:react_native_minor_version] < minimalReactNativeVersion + raise "[Reanimated] Unsupported React Native version. Please use #{minimalReactNativeVersion} or newer." end end