Skip to content
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

feat!: drop support for react-native below 0.70 #2307

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions .github/actions/gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,11 @@ inputs:
runs:
using: composite
steps:
- name: Determine build root directory
id: build-root-directory-finder
run: |
if [[ -f android/build.gradle ]]; then
echo "build-root-directory=${{ inputs.project-root }}/android" >> $GITHUB_OUTPUT
else
echo "build-root-directory=${{ inputs.project-root }}" >> $GITHUB_OUTPUT
fi
shell: bash
working-directory: ${{ inputs.project-root }}
- name: Configure Gradle wrapper
run: |
node --eval "require('./android/gradle-wrapper.js').configureGradleWrapper('${{ steps.build-root-directory-finder.outputs.build-root-directory }}')"
node --eval "require('./android/gradle-wrapper.js').configureGradleWrapper('${{ inputs.project-root }}/android')"
shell: bash
- name: Build
run: ./gradlew ${{ inputs.arguments }}
shell: bash
working-directory: ${{ steps.build-root-directory-finder.outputs.build-root-directory }}
working-directory: ${{ inputs.project-root }}/android
42 changes: 7 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,24 +226,15 @@ jobs:
- name: Determine whether the iOS app needs to be built
id: affected
uses: ./.github/actions/affected
- name: Determine project directory
id: configure
if: ${{ steps.affected.outputs.ios != '' }}
run: |
if [[ ${{ matrix.template }} == ios ]]; then
echo 'project-directory=.' >> $GITHUB_OUTPUT
else
echo 'project-directory=ios' >> $GITHUB_OUTPUT
fi
- name: Install Pods
if: ${{ steps.affected.outputs.ios != '' }}
run: |
pod install --project-directory=${{ steps.configure.outputs.project-directory }}
pod install --project-directory=ios
working-directory: template-example
- name: Build
if: ${{ steps.affected.outputs.ios != '' }}
run: |
../scripts/build/xcodebuild.sh ${{ steps.configure.outputs.project-directory }}/TemplateExample.xcworkspace build
../scripts/build/xcodebuild.sh ios/TemplateExample.xcworkspace build
working-directory: template-example
- name: react-native run-ios
if: ${{ steps.affected.outputs.ios != '' }}
Expand Down Expand Up @@ -439,24 +430,15 @@ jobs:
- name: Determine whether the macOS app needs to be built
id: affected
uses: ./.github/actions/affected
- name: Determine project directory
id: configure
if: ${{ steps.affected.outputs.macos != '' }}
run: |
if [[ ${{ matrix.template }} == macos ]]; then
echo 'project-directory=.' >> $GITHUB_OUTPUT
else
echo 'project-directory=macos' >> $GITHUB_OUTPUT
fi
- name: Install Pods
if: ${{ steps.affected.outputs.macos != '' }}
run: |
pod install --project-directory=${{ steps.configure.outputs.project-directory }}
pod install --project-directory=macos
working-directory: template-example
- name: Build
if: ${{ steps.affected.outputs.macos != '' }}
run: |
../scripts/build/xcodebuild.sh ${{ steps.configure.outputs.project-directory }}/TemplateExample.xcworkspace build
../scripts/build/xcodebuild.sh macos/TemplateExample.xcworkspace build
working-directory: template-example
timeout-minutes: 60
visionos:
Expand Down Expand Up @@ -540,24 +522,15 @@ jobs:
- name: Determine whether the visionOS app needs to be built
id: affected
uses: ./.github/actions/affected
- name: Determine project directory
id: configure
if: ${{ steps.affected.outputs.visionos != '' }}
run: |
if [[ ${{ matrix.template }} == visionos ]]; then
echo 'project-directory=.' >> $GITHUB_OUTPUT
else
echo 'project-directory=visionos' >> $GITHUB_OUTPUT
fi
- name: Install Pods
if: ${{ steps.affected.outputs.visionos != '' }}
run: |
pod install --project-directory=${{ steps.configure.outputs.project-directory }}
pod install --project-directory=visionos
working-directory: template-example
- name: Build
if: ${{ steps.affected.outputs.visionos != '' }}
run: |
../scripts/build/xcodebuild.sh ${{ steps.configure.outputs.project-directory }}/TemplateExample.xcworkspace build
../scripts/build/xcodebuild.sh visionos/TemplateExample.xcworkspace build
working-directory: template-example
timeout-minutes: 60
windows:
Expand Down Expand Up @@ -642,8 +615,7 @@ jobs:
yarn build:windows
- name: Generate Visual Studio solution
run: |
if ("${{ matrix.template }}" -eq "all") { yarn install-windows-test-app --use-nuget }
else { yarn install-windows-test-app --project-directory=. --use-nuget }
yarn install-windows-test-app --use-nuget
working-directory: template-example
- name: Determine whether the Windows app needs to be built
id: affected
Expand Down
46 changes: 2 additions & 44 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,8 @@ android {
}
}

// TODO: Remove this block when minSdkVersion >= 24. See
// https://stackoverflow.com/q/53402639 for details.
if (reactNativeVersion > 0 && reactNativeVersion < v(0, 69, 0)) {
compileOptions {
sourceCompatibility(JavaVersion.VERSION_1_8)
targetCompatibility(JavaVersion.VERSION_1_8)
}
}

kotlinOptions {
allWarningsAsErrors = true
if (reactNativeVersion > 0) {
if (reactNativeVersion < v(0, 69, 0)) {
jvmTarget = JavaVersion.VERSION_1_8
} else if (reactNativeVersion < v(0, 73, 0)) {
jvmTarget = JavaVersion.VERSION_11
}
// else let `@react-native/gradle-plugin` handle this
}
}

defaultConfig {
Expand Down Expand Up @@ -217,12 +200,6 @@ android {
? "src/new-arch-0.73/java"
: "src/new-arch/java",

// TODO: Remove this block when we drop support for 0.67
// https://github.com/facebook/react-native/commit/ce74aa4ed335d4c36ce722d47937b582045e05c4
reactNativeVersion > 0 && reactNativeVersion < v(0, 68, 0)
? "src/reactinstanceeventlistener-pre-0.68/java"
: "src/reactinstanceeventlistener-0.68/java",

// TODO: Remove this block when we drop support for 0.74
// https://github.com/facebook/react-native/commit/3283202248a36dbda553745afc46a3e3e2ab41a6
reactNativeVersion >= v(0, 75, 0)
Expand Down Expand Up @@ -278,22 +255,10 @@ dependencies {
if (project.ext.react.enableHermes) {
if (autodetectReactNativeVersion) {
implementation("com.facebook.react:hermes-android")
} else if (reactNativeVersion >= v(0, 69, 0)) {
} else {
implementation("com.facebook.react:hermes-engine:+") {
exclude(group: "com.facebook.fbjni")
}
} else {
// TODO: Remove this block when we drop support for 0.68.
def hermesEngineDir =
findNodeModulesPath("hermes-engine", reactNativePath)
?: findNodeModulesPath("hermesvm", reactNativePath)
if (hermesEngineDir == null) {
throw new GradleException("Could not find 'hermes-engine'. Please make sure you've added it to 'package.json'.")
}

def hermesAndroidDir = "${hermesEngineDir}/android"
releaseImplementation files("${hermesAndroidDir}/hermes-release.aar")
debugImplementation files("${hermesAndroidDir}/hermes-debug.aar")
}
}

Expand All @@ -304,14 +269,7 @@ dependencies {
implementation("com.facebook.react:react-native:${version}")
}

if (reactNativeVersion > 0 && reactNativeVersion < v(0, 68, 0)) {
// androidx.appcompat:appcompat:1.4.0+ breaks TextInput. This was fixed
// in react-native 0.68. For more details, see
// https://github.com/facebook/react-native/issues/31572.
implementation(["androidx.appcompat", "appcompat", "1.3.1"].join(":"))
} else {
implementation libraries.androidAppCompat
}
implementation libraries.androidAppCompat
implementation libraries.androidCoreKotlinExtensions
implementation libraries.androidRecyclerView
implementation libraries.materialComponents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.facebook.react.ReactActivity
import com.facebook.react.ReactInstanceEventListener
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContext
import com.facebook.react.modules.systeminfo.ReactNativeVersion
import com.facebook.react.packagerconnection.PackagerConnectionSettings
import com.google.android.material.appbar.MaterialToolbar
import com.microsoft.reacttestapp.camera.canUseCamera
import com.microsoft.reacttestapp.camera.scanForQrCode
import com.microsoft.reacttestapp.compat.ReactInstanceEventListener
import com.microsoft.reacttestapp.component.ComponentActivity
import com.microsoft.reacttestapp.component.ComponentBottomSheetDialogFragment
import com.microsoft.reacttestapp.component.ComponentListAdapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.net.Uri
import android.os.Bundle
import com.facebook.hermes.reactexecutor.HermesExecutorFactory
import com.facebook.react.PackageList
import com.facebook.react.ReactInstanceEventListener
import com.facebook.react.ReactInstanceManager
import com.facebook.react.ReactPackage
import com.facebook.react.bridge.JavaScriptExecutorFactory
Expand All @@ -18,7 +19,6 @@ import com.facebook.react.packagerconnection.PackagerConnectionSettings
import com.microsoft.reacttestapp.BuildConfig
import com.microsoft.reacttestapp.MainActivity
import com.microsoft.reacttestapp.R
import com.microsoft.reacttestapp.compat.ReactInstanceEventListener
import com.microsoft.reacttestapp.compat.ReactNativeHostCompat
import java.lang.ref.WeakReference
import java.util.Collections.synchronizedList
Expand Down

This file was deleted.

This file was deleted.

12 changes: 1 addition & 11 deletions android/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ def getDefaultGradlePluginVersion = { int reactNativeVersion ->
}
}

// TODO: Bump `minSdkVersion` to 24 in 4.0
def getDefaultMinSdkVersion = { int reactNativeVersion ->
if (reactNativeVersion >= v(0, 76, 0)) {
return 24
} else {
return 23
}
}

def getKotlinVersion = { File baseDir ->
def fallbackVersion = "1.7.21"

Expand All @@ -49,8 +40,7 @@ ext {
reactNativeVersion = getPackageVersionNumber("react-native", rootDir)

compileSdkVersion = rootProject.findProperty("react.compileSdkVersion") ?: 34
minSdkVersion = rootProject.findProperty("react.minSdkVersion")
?: getDefaultMinSdkVersion(reactNativeVersion)
minSdkVersion = rootProject.findProperty("react.minSdkVersion") ?: 24
targetSdkVersion = rootProject.findProperty("react.targetSdkVersion") ?: 33

autodetectReactNativeVersion = reactNativeVersion == 0 || reactNativeVersion >= v(0, 71, 0)
Expand Down
4 changes: 2 additions & 2 deletions example/Example-Tests.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Pod::Spec.new do |s|
s.source = { :git => package['repository']['url'] }
s.summary = 'Example tests'

s.ios.deployment_target = '13.0'
s.osx.deployment_target = '10.15'
s.ios.deployment_target = '15.1'
s.osx.deployment_target = '12.0'
s.visionos.deployment_target = '1.0'

s.dependency 'React'
Expand Down
Loading
Loading