diff --git a/examples/detox/android/app/build.gradle b/examples/detox/android/app/build.gradle index 29dd576..563fbdb 100644 --- a/examples/detox/android/app/build.gradle +++ b/examples/detox/android/app/build.gradle @@ -74,7 +74,10 @@ dependencies { implementation 'com.android.support:appcompat-v7:28.0.0' // noinspection GradleDynamicVersion - implementation 'com.facebook.react:react-native:+' + implementation ('com.facebook.react:react-native:0.59.9') { + force = true + } + androidTestImplementation('com.wix:detox:+') { transitive = true } androidTestImplementation 'junit:junit:4.12' diff --git a/examples/detox/fix-rn-version.ts b/examples/detox/fix-rn-version.ts new file mode 100644 index 0000000..07b2f5c --- /dev/null +++ b/examples/detox/fix-rn-version.ts @@ -0,0 +1,10 @@ +import fs from 'fs' + +const file = '../../android/build.gradle' +const replace = /implementation 'com.facebook.react:react-native:\+'/g +const replacement = "implementation 'com.facebook.react:react-native:0.59.9'" +const encoding = 'utf8' + +const data = fs.readFileSync(file, encoding) +const result = data.replace(replace, replacement) +fs.writeFileSync(file, result, encoding) diff --git a/examples/detox/package.json b/examples/detox/package.json index 0c61cd0..3c27a81 100644 --- a/examples/detox/package.json +++ b/examples/detox/package.json @@ -5,7 +5,7 @@ "scripts": { "start": "react-native start", "postinstall": "yarn make-example-runnable", - "make-example-runnable": "(cd ../../ && npm i react react-native --no-save)", + "make-example-runnable": "(cd ../../ && npm i react react-native --no-save) && npx tsx ./fix-rn-version.ts", "build:ios": "detox build --configuration ios.debug", "build:android-debug": "detox build --configuration android.debug", "build:android-ci": "detox build --configuration android.ci",