@@ -13,14 +13,13 @@ plugins {
13
13
def enableNewArchitecture = isNewArchitectureEnabled(project)
14
14
def reactNativeVersion = getPackageVersionNumber(" react-native" , rootDir)
15
15
def reactNativePath = file(findNodeModulesPath(" react-native" , rootDir))
16
- def codegenPath = file(findNodeModulesPath(" react-native-codegen" , reactNativePath))
17
16
18
17
if (reactNativeVersion == 0 || enableNewArchitecture) {
19
18
apply(plugin : " com.facebook.react" )
20
19
21
20
if (enableNewArchitecture) {
22
21
react {
23
- codegenDir = codegenPath
22
+ codegenDir = file(findNodeModulesPath( " react-native-codegen " , reactNativePath))
24
23
reactNativeDir = reactNativePath
25
24
}
26
25
}
@@ -245,7 +244,7 @@ android {
245
244
// `.gradle/caches/modules-2/files-2.1/com.facebook.react/react-native`.
246
245
// For now, we will simply disable this step as we only need to verify
247
246
// that things build.
248
- if (reactNativeVersion > 0 ) {
247
+ if (reactNativeVersion > 0 && reactNativeVersion < 7100 ) {
249
248
def version = getPackageVersion(" react-native" , rootDir)
250
249
def allAar = file(" ${ reactNativePath} /android/com/facebook/react/react-native/${ version} /react-native-${ version} .aar" )
251
250
@@ -373,8 +372,11 @@ dependencies {
373
372
374
373
if (project. ext. react. enableNewArchitecture) {
375
374
implementation project(" :ReactAndroid" )
375
+ } else if (reactNativeVersion == 0 || reactNativeVersion >= 7100 ) {
376
+ implementation(" com.facebook.react:react-native" )
376
377
} else {
377
- implementation " com.facebook.react:react-native:+"
378
+ def version = getPackageVersion(" react-native" , rootDir)
379
+ implementation(" com.facebook.react:react-native:${ version} " )
378
380
}
379
381
380
382
implementation libraries. kotlinStdlibJdk7
@@ -434,6 +436,16 @@ if (project.ext.react.enableNewArchitecture) {
434
436
.because(" On New Architecture, we are building Hermes from source" )
435
437
}
436
438
}
439
+ } else if (reactNativeVersion > 0 && reactNativeVersion < 7100 ) {
440
+ configurations. all {
441
+ resolutionStrategy {
442
+ // Force version here otherwise Gradle will pick up a newer version:
443
+ // https://github.com/facebook/react-native/issues/35210
444
+ def version = getPackageVersion(" react-native" , rootDir)
445
+ force(" com.facebook.react:react-native:${ version} " )
446
+ force(" com.facebook.react:hermes-engine:${ version} " )
447
+ }
448
+ }
437
449
}
438
450
439
451
// `@react-native-community/cli` currently requires this function to be defined.
0 commit comments