Skip to content

Commit 9145b17

Browse files
authored
fix: declare support for react-native 0.69 (#891)
1 parent 09e61fd commit 9145b17

File tree

8 files changed

+46
-40
lines changed

8 files changed

+46
-40
lines changed

android/app/build.gradle

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ plugins {
1616
buildDir = "${rootDir}/${name}/build"
1717

1818
def reactNativeDir = findNodeModulesPath(rootDir, "react-native")
19+
def reactNativeVersion = getReactNativeVersionNumber(rootDir)
1920

2021
repositories {
2122
maven {
@@ -26,7 +27,7 @@ repositories {
2627
google()
2728

2829
// TODO: Remove this block when we drop support for 0.64.
29-
if (getReactNativeVersionNumber(rootDir) < 6500) {
30+
if (reactNativeVersion < 6500) {
3031
// Artifacts for 0.65+ are published to Maven Central. If we're on an
3132
// older version, we still need to use JCenter.
3233
// noinspection JcenterRepositoryObsolete
@@ -69,14 +70,20 @@ android {
6970

7071
// TODO: Remove this block when minSdkVersion >= 24. See
7172
// https://stackoverflow.com/q/53402639 for details.
72-
compileOptions {
73-
sourceCompatibility JavaVersion.VERSION_1_8
74-
targetCompatibility JavaVersion.VERSION_1_8
73+
if (reactNativeVersion < 6900) {
74+
compileOptions {
75+
sourceCompatibility(JavaVersion.VERSION_1_8)
76+
targetCompatibility(JavaVersion.VERSION_1_8)
77+
}
7578
}
7679

7780
kotlinOptions {
7881
allWarningsAsErrors = true
79-
jvmTarget = JavaVersion.VERSION_1_8
82+
if (reactNativeVersion < 6900) {
83+
jvmTarget = JavaVersion.VERSION_1_8
84+
} else {
85+
jvmTarget = JavaVersion.VERSION_11
86+
}
8087
}
8188

8289
defaultConfig {
@@ -149,7 +156,7 @@ android {
149156

150157
// TODO: Remove this block when we drop support for 0.67.
151158
// https://github.com/facebook/react-native/commit/ce74aa4ed335d4c36ce722d47937b582045e05c4
152-
if (getReactNativeVersionNumber(rootDir) < 6800) {
159+
if (reactNativeVersion < 6800) {
153160
main.java.srcDirs += "src/reactinstanceeventlistener-pre-0.68/java"
154161
} else {
155162
main.java.srcDirs += "src/reactinstanceeventlistener-0.68/java"
@@ -161,16 +168,23 @@ dependencies {
161168
implementation project(":support")
162169

163170
if (project.ext.react.enableHermes) {
164-
def hermesEngineDir =
165-
findNodeModulesPath(file(reactNativeDir), "hermes-engine")
166-
?: findNodeModulesPath(file(reactNativeDir), "hermesvm")
167-
if (hermesEngineDir == null) {
168-
throw new GradleException("Could not find 'hermes-engine'. Please make sure you've added it to 'package.json'.")
169-
}
171+
// TODO: Remove this block when we drop support for 0.68.
172+
if (reactNativeVersion < 6900) {
173+
def hermesEngineDir =
174+
findNodeModulesPath(file(reactNativeDir), "hermes-engine")
175+
?: findNodeModulesPath(file(reactNativeDir), "hermesvm")
176+
if (hermesEngineDir == null) {
177+
throw new GradleException("Could not find 'hermes-engine'. Please make sure you've added it to 'package.json'.")
178+
}
170179

171-
def hermesAndroidDir = "${hermesEngineDir}/android"
172-
releaseImplementation files("${hermesAndroidDir}/hermes-release.aar")
173-
debugImplementation files("${hermesAndroidDir}/hermes-debug.aar")
180+
def hermesAndroidDir = "${hermesEngineDir}/android"
181+
releaseImplementation files("${hermesAndroidDir}/hermes-release.aar")
182+
debugImplementation files("${hermesAndroidDir}/hermes-debug.aar")
183+
} else {
184+
implementation("com.facebook.react:hermes-engine:+") {
185+
exclude(group: "com.facebook.fbjni")
186+
}
187+
}
174188
}
175189

176190
if (buildReactNativeFromSource(rootDir)) {

android/build.gradle

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

example/android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pluginManagement {
22
repositories {
33
gradlePluginPortal()
4-
mavenLocal()
4+
mavenCentral()
55
google()
66
}
77
}

example/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"windows": "react-native run-windows --no-packager"
1818
},
1919
"peerDependencies": {
20-
"react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2",
21-
"react-native": "^0.0.0-0 || 0.62 - 0.68 || 1000.0.0",
20+
"react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0",
21+
"react-native": "^0.0.0-0 || 0.62 - 0.69 || 1000.0.0",
2222
"react-native-macos": "^0.0.0-0 || 0.62 - 0.66",
23-
"react-native-windows": "^0.0.0-0 || 0.62 - 0.68"
23+
"react-native-windows": "^0.0.0-0 || 0.62 - 0.69"
2424
},
2525
"devDependencies": {
2626
"@babel/core": "^7.0.0",

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@
8080
"@react-native-community/cli-platform-android": ">=4.10.0",
8181
"@react-native-community/cli-platform-ios": ">=4.10.0",
8282
"mustache": "^4.0.0",
83-
"react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2",
84-
"react-native": "^0.0.0-0 || 0.62 - 0.68 || 1000.0.0",
83+
"react": "~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0",
84+
"react-native": "^0.0.0-0 || 0.62 - 0.69 || 1000.0.0",
8585
"react-native-macos": "^0.0.0-0 || 0.62 - 0.66",
86-
"react-native-windows": "^0.0.0-0 || 0.62 - 0.68"
86+
"react-native-windows": "^0.0.0-0 || 0.62 - 0.69"
8787
},
8888
"peerDependenciesMeta": {
8989
"@react-native-community/cli": {

scripts/configure.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ const getConfig = (() => {
544544
"pluginManagement {",
545545
" repositories {",
546546
" gradlePluginPortal()",
547-
" mavenLocal()",
547+
" mavenCentral()",
548548
" google()",
549549
" }",
550550
"}",

test/configure/__snapshots__/gatherConfig.test.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ allprojects {
113113
"android/settings.gradle": "pluginManagement {
114114
repositories {
115115
gradlePluginPortal()
116-
mavenLocal()
116+
mavenCentral()
117117
google()
118118
}
119119
}
@@ -410,7 +410,7 @@ allprojects {
410410
"android/settings.gradle": "pluginManagement {
411411
repositories {
412412
gradlePluginPortal()
413-
mavenLocal()
413+
mavenCentral()
414414
google()
415415
}
416416
}
@@ -556,7 +556,7 @@ allprojects {
556556
"android/settings.gradle": "pluginManagement {
557557
repositories {
558558
gradlePluginPortal()
559-
mavenLocal()
559+
mavenCentral()
560560
google()
561561
}
562562
}

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5339,10 +5339,10 @@ __metadata:
53395339
react-native-test-app: "workspace:."
53405340
react-native-windows: ^0.66.11
53415341
peerDependencies:
5342-
react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2
5343-
react-native: ^0.0.0-0 || 0.62 - 0.68 || 1000.0.0
5342+
react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0
5343+
react-native: ^0.0.0-0 || 0.62 - 0.69 || 1000.0.0
53445344
react-native-macos: ^0.0.0-0 || 0.62 - 0.66
5345-
react-native-windows: ^0.0.0-0 || 0.62 - 0.68
5345+
react-native-windows: ^0.0.0-0 || 0.62 - 0.69
53465346
languageName: unknown
53475347
linkType: soft
53485348

@@ -10509,10 +10509,10 @@ __metadata:
1050910509
"@react-native-community/cli-platform-android": ">=4.10.0"
1051010510
"@react-native-community/cli-platform-ios": ">=4.10.0"
1051110511
mustache: ^4.0.0
10512-
react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2
10513-
react-native: ^0.0.0-0 || 0.62 - 0.68 || 1000.0.0
10512+
react: ~16.11.0 || ~16.13.1 || ~17.0.1 || ~17.0.2 || ~18.0.0
10513+
react-native: ^0.0.0-0 || 0.62 - 0.69 || 1000.0.0
1051410514
react-native-macos: ^0.0.0-0 || 0.62 - 0.66
10515-
react-native-windows: ^0.0.0-0 || 0.62 - 0.68
10515+
react-native-windows: ^0.0.0-0 || 0.62 - 0.69
1051610516
peerDependenciesMeta:
1051710517
"@react-native-community/cli":
1051810518
optional: true

0 commit comments

Comments
 (0)