Skip to content

Commit 2c7583d

Browse files
committed
feat: bump minimum react-native version to 0.70
BREAKING CHANGE: Dropped support for versions older than 0.70
1 parent fd4fc1c commit 2c7583d

File tree

27 files changed

+63
-505
lines changed

27 files changed

+63
-505
lines changed

android/app/build.gradle

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,8 @@ android {
8484
}
8585
}
8686

87-
// TODO: Remove this block when minSdkVersion >= 24. See
88-
// https://stackoverflow.com/q/53402639 for details.
89-
if (reactNativeVersion > 0 && reactNativeVersion < v(0, 69, 0)) {
90-
compileOptions {
91-
sourceCompatibility(JavaVersion.VERSION_1_8)
92-
targetCompatibility(JavaVersion.VERSION_1_8)
93-
}
94-
}
95-
9687
kotlinOptions {
9788
allWarningsAsErrors = true
98-
if (reactNativeVersion > 0) {
99-
if (reactNativeVersion < v(0, 69, 0)) {
100-
jvmTarget = JavaVersion.VERSION_1_8
101-
} else if (reactNativeVersion < v(0, 73, 0)) {
102-
jvmTarget = JavaVersion.VERSION_11
103-
}
104-
// else let `@react-native/gradle-plugin` handle this
105-
}
10689
}
10790

10891
defaultConfig {
@@ -217,12 +200,6 @@ android {
217200
? "src/new-arch-0.73/java"
218201
: "src/new-arch/java",
219202

220-
// TODO: Remove this block when we drop support for 0.67
221-
// https://github.com/facebook/react-native/commit/ce74aa4ed335d4c36ce722d47937b582045e05c4
222-
reactNativeVersion > 0 && reactNativeVersion < v(0, 68, 0)
223-
? "src/reactinstanceeventlistener-pre-0.68/java"
224-
: "src/reactinstanceeventlistener-0.68/java",
225-
226203
// TODO: Remove this block when we drop support for 0.74
227204
// https://github.com/facebook/react-native/commit/3283202248a36dbda553745afc46a3e3e2ab41a6
228205
reactNativeVersion >= v(0, 75, 0)
@@ -278,22 +255,10 @@ dependencies {
278255
if (project.ext.react.enableHermes) {
279256
if (autodetectReactNativeVersion) {
280257
implementation("com.facebook.react:hermes-android")
281-
} else if (reactNativeVersion >= v(0, 69, 0)) {
258+
} else {
282259
implementation("com.facebook.react:hermes-engine:+") {
283260
exclude(group: "com.facebook.fbjni")
284261
}
285-
} else {
286-
// TODO: Remove this block when we drop support for 0.68.
287-
def hermesEngineDir =
288-
findNodeModulesPath("hermes-engine", reactNativePath)
289-
?: findNodeModulesPath("hermesvm", reactNativePath)
290-
if (hermesEngineDir == null) {
291-
throw new GradleException("Could not find 'hermes-engine'. Please make sure you've added it to 'package.json'.")
292-
}
293-
294-
def hermesAndroidDir = "${hermesEngineDir}/android"
295-
releaseImplementation files("${hermesAndroidDir}/hermes-release.aar")
296-
debugImplementation files("${hermesAndroidDir}/hermes-debug.aar")
297262
}
298263
}
299264

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

307-
if (reactNativeVersion > 0 && reactNativeVersion < v(0, 68, 0)) {
308-
// androidx.appcompat:appcompat:1.4.0+ breaks TextInput. This was fixed
309-
// in react-native 0.68. For more details, see
310-
// https://github.com/facebook/react-native/issues/31572.
311-
implementation(["androidx.appcompat", "appcompat", "1.3.1"].join(":"))
312-
} else {
313-
implementation libraries.androidAppCompat
314-
}
272+
implementation libraries.androidAppCompat
315273
implementation libraries.androidCoreKotlinExtensions
316274
implementation libraries.androidRecyclerView
317275
implementation libraries.materialComponents

android/app/src/main/java/com/microsoft/reacttestapp/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import androidx.recyclerview.widget.DividerItemDecoration
1313
import androidx.recyclerview.widget.LinearLayoutManager
1414
import androidx.recyclerview.widget.RecyclerView
1515
import com.facebook.react.ReactActivity
16+
import com.facebook.react.ReactInstanceEventListener
1617
import com.facebook.react.bridge.ReactApplicationContext
1718
import com.facebook.react.bridge.ReactContext
1819
import com.facebook.react.modules.systeminfo.ReactNativeVersion
1920
import com.facebook.react.packagerconnection.PackagerConnectionSettings
2021
import com.google.android.material.appbar.MaterialToolbar
2122
import com.microsoft.reacttestapp.camera.canUseCamera
2223
import com.microsoft.reacttestapp.camera.scanForQrCode
23-
import com.microsoft.reacttestapp.compat.ReactInstanceEventListener
2424
import com.microsoft.reacttestapp.component.ComponentActivity
2525
import com.microsoft.reacttestapp.component.ComponentBottomSheetDialogFragment
2626
import com.microsoft.reacttestapp.component.ComponentListAdapter

android/app/src/main/java/com/microsoft/reacttestapp/react/TestAppReactNativeHost.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import android.net.Uri
99
import android.os.Bundle
1010
import com.facebook.hermes.reactexecutor.HermesExecutorFactory
1111
import com.facebook.react.PackageList
12+
import com.facebook.react.ReactInstanceEventListener
1213
import com.facebook.react.ReactInstanceManager
1314
import com.facebook.react.ReactPackage
1415
import com.facebook.react.bridge.JavaScriptExecutorFactory
@@ -18,7 +19,6 @@ import com.facebook.react.packagerconnection.PackagerConnectionSettings
1819
import com.microsoft.reacttestapp.BuildConfig
1920
import com.microsoft.reacttestapp.MainActivity
2021
import com.microsoft.reacttestapp.R
21-
import com.microsoft.reacttestapp.compat.ReactInstanceEventListener
2222
import com.microsoft.reacttestapp.compat.ReactNativeHostCompat
2323
import java.lang.ref.WeakReference
2424
import java.util.Collections.synchronizedList

android/app/src/reactinstanceeventlistener-0.68/java/com/microsoft/reacttestapp/compat/ReactInstanceEventListener.kt

Lines changed: 0 additions & 3 deletions
This file was deleted.

android/app/src/reactinstanceeventlistener-pre-0.68/java/com/microsoft/reacttestapp/compat/ReactInstanceEventListener.kt

Lines changed: 0 additions & 5 deletions
This file was deleted.

example/test/config.test.mjs

Lines changed: 21 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,9 @@
11
// @ts-check
2-
import { deepEqual, equal, match, notEqual, ok } from "node:assert/strict";
2+
import { equal, match, notEqual, ok } from "node:assert/strict";
33
import * as fs from "node:fs";
44
import * as path from "node:path";
55
import { after, before, test } from "node:test";
66
import { URL, fileURLToPath } from "node:url";
7-
import { findNearest, readJSONFile } from "../../scripts/helpers.js";
8-
9-
function getCliVersion() {
10-
const cli = findNearest(
11-
"node_modules/@react-native-community/cli/package.json"
12-
);
13-
if (!cli) {
14-
throw new Error("Could not find '@react-native-community/cli'");
15-
}
16-
17-
const { version } = readJSONFile(cli);
18-
if (typeof version !== "string") {
19-
throw new Error(
20-
`Invalid version string for '@react-native-community/cli': ${version}`
21-
);
22-
}
23-
24-
return version;
25-
}
267

278
async function getLoadConfig() {
289
try {
@@ -50,7 +31,6 @@ function regexp(p) {
5031

5132
test("react-native config", async (t) => {
5233
const loadConfig = await getLoadConfig();
53-
const cliMajorVersion = Number(getCliVersion().split(".")[0]);
5434

5535
const currentDir = process.cwd();
5636
const projectRoot = path.sep + "react-native-test-app";
@@ -65,109 +45,29 @@ test("react-native config", async (t) => {
6545

6646
after(() => process.chdir(currentDir));
6747

68-
await t.test(
69-
"contains Android config (@react-native-community/cli <8.0.0)",
70-
{ skip: cliMajorVersion >= 8 },
71-
() => {
72-
const sourceDir = path.join(exampleRoot, "android");
73-
const config = loadConfig();
74-
75-
equal(typeof config, "object");
76-
match(config.root, regexp(exampleRoot));
77-
match(config.reactNativePath, regexp(reactNativePath));
78-
equal(
79-
config.dependencies["react-native-test-app"].name,
80-
"react-native-test-app"
81-
);
82-
deepEqual(config.assets, []);
83-
notEqual(config.platforms.android, undefined);
84-
match(config.project.android.sourceDir, regexp(sourceDir));
85-
match(config.project.android.folder, regexp(exampleRoot));
86-
match(
87-
config.project.android.manifestPath,
88-
regexp(
89-
path.join(
90-
"react-native-test-app",
91-
"android",
92-
"app",
93-
"src",
94-
"main",
95-
"AndroidManifest.xml"
96-
)
97-
)
98-
);
99-
match(
100-
config.project.android.buildGradlePath,
101-
regexp(path.join(sourceDir, "build.gradle"))
102-
);
103-
match(
104-
config.project.android.settingsGradlePath,
105-
regexp(path.join(sourceDir, "settings.gradle"))
106-
);
107-
equal(config.project.android.packageName, "com.microsoft.reacttestapp");
108-
equal(
109-
config.project.android.packageFolder,
110-
path.join("com", "microsoft", "reacttestapp")
111-
);
112-
}
113-
);
114-
115-
await t.test(
116-
"contains Android config (@react-native-community/cli >=8.0.0)",
117-
{ skip: cliMajorVersion < 8 },
118-
() => {
119-
const sourceDir = path.join(exampleRoot, "android");
120-
const config = loadConfig();
121-
122-
equal(typeof config, "object");
123-
match(config.root, regexp(exampleRoot));
124-
match(config.reactNativePath, regexp(reactNativePath));
125-
equal(
126-
config.dependencies["react-native-test-app"].name,
127-
"react-native-test-app"
128-
);
129-
notEqual(config.platforms.android, undefined);
130-
match(config.project.android.sourceDir, regexp(sourceDir));
131-
equal(
132-
config.project.android.appName,
133-
fs.existsSync("android/app") ? "app" : ""
134-
);
135-
equal(config.project.android.packageName, "com.microsoft.reacttestapp");
136-
}
137-
);
138-
139-
await t.test(
140-
"contains iOS config (@react-native-community/cli <8.0.0)",
141-
{ skip: process.platform === "win32" || cliMajorVersion >= 8 },
142-
() => {
143-
const sourceDir = path.join(exampleRoot, "ios");
144-
const config = loadConfig();
48+
await t.test("contains Android config", () => {
49+
const sourceDir = path.join(exampleRoot, "android");
50+
const config = loadConfig();
14551

146-
equal(typeof config, "object");
147-
match(config.root, regexp(exampleRoot));
148-
match(config.reactNativePath, regexp(reactNativePath));
149-
equal(
150-
config.dependencies["react-native-test-app"].name,
151-
"react-native-test-app"
152-
);
153-
deepEqual(config.assets, []);
154-
notEqual(config.platforms.ios, undefined);
155-
match(config.project.ios.sourceDir, regexp(sourceDir));
156-
match(config.project.ios.folder, regexp(exampleRoot));
157-
match(
158-
config.project.ios.podfile,
159-
regexp(path.join(sourceDir, "Podfile"))
160-
);
161-
match(
162-
config.project.ios.podspecPath,
163-
regexp(path.join(exampleRoot, "Example-Tests.podspec"))
164-
);
165-
}
166-
);
52+
equal(typeof config, "object");
53+
match(config.root, regexp(exampleRoot));
54+
match(config.reactNativePath, regexp(reactNativePath));
55+
equal(
56+
config.dependencies["react-native-test-app"].name,
57+
"react-native-test-app"
58+
);
59+
notEqual(config.platforms.android, undefined);
60+
match(config.project.android.sourceDir, regexp(sourceDir));
61+
equal(
62+
config.project.android.appName,
63+
fs.existsSync("android/app") ? "app" : ""
64+
);
65+
equal(config.project.android.packageName, "com.microsoft.reacttestapp");
66+
});
16767

16868
await t.test(
169-
"contains iOS config (@react-native-community/cli >=8.0.0)",
170-
{ skip: process.platform === "win32" || cliMajorVersion < 8 },
69+
"contains iOS config",
70+
{ skip: process.platform === "win32" },
17171
() => {
17272
const sourceDir = path.join(exampleRoot, "ios");
17373
const config = loadConfig();

ios/test_app.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ def react_native_pods(version)
6767
'use_react_native-0.71'
6868
elsif version >= v(0, 70, 0)
6969
'use_react_native-0.70'
70-
elsif version >= v(0, 68, 0)
71-
'use_react_native-0.68'
72-
elsif version >= v(0, 66, 0)
73-
'use_react_native-0.64'
7470
else
7571
raise "Unsupported React Native version: #{version}"
7672
end

ios/use_react_native-0.64.rb

Lines changed: 0 additions & 30 deletions
This file was deleted.

ios/use_react_native-0.68.rb

Lines changed: 0 additions & 24 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@
9999
"peerDependencies": {
100100
"@callstack/react-native-visionos": "0.73 - 0.76",
101101
"@expo/config-plugins": ">=5.0",
102-
"react": "17.0.1 - 19.0",
103-
"react-native": "0.66 - 0.76 || >=0.77.0-0 <0.77.0",
104-
"react-native-macos": "^0.0.0-0 || 0.66 || 0.68 || 0.71 - 0.76",
105-
"react-native-windows": "^0.0.0-0 || 0.66 - 0.76"
102+
"react": "18.1 - 19.0",
103+
"react-native": "0.70 - 0.76 || >=0.77.0-0 <0.77.0",
104+
"react-native-macos": "^0.0.0-0 || 0.71 - 0.76",
105+
"react-native-windows": "^0.0.0-0 || 0.70 - 0.76"
106106
},
107107
"peerDependenciesMeta": {
108108
"@callstack/react-native-visionos": {

0 commit comments

Comments
 (0)