Skip to content

Commit e8803f5

Browse files
authored
Upgrade to rn 68 (wix#907)
* upgrade android and JS to RN@68 * simplify logic * upgrade to jest@27 * fix eventsRegistry tests * upgrade example ios to RN68 * update detox
1 parent e634fa5 commit e8803f5

25 files changed

+911
-320
lines changed

.detoxrc.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"testRunner": "jest",
3+
"runnerConfig": "e2e/config.json",
4+
"skipLegacyWorkersInjection": true,
5+
"devices": {
6+
"simulator": {
7+
"type": "ios.simulator",
8+
"device": {
9+
"type": "iPhone 12 Pro Max"
10+
}
11+
}
12+
},
13+
"apps": {
14+
"ios.release": {
15+
"name": "RNNotifications",
16+
"type": "ios.app",
17+
"binaryPath": "example/ios/DerivedData/NotificationsExampleApp/Build/Products/Release-iphonesimulator/NotificationsExampleApp.app",
18+
"build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme NotificationsExampleApp_release -workspace example/ios/NotificationsExampleApp.xcworkspace -sdk iphonesimulator -configuration Release -derivedDataPath example/ios/DerivedData/NotificationsExampleApp ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO"
19+
},
20+
"ios.debug": {
21+
"name": "RNNotificationsDebug",
22+
"type": "ios.app",
23+
"binaryPath": "example/ios/DerivedData/NotificationsExampleApp/Build/Products/Debug-iphonesimulator/NotificationsExampleApp.app",
24+
"build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme NotificationsExampleApp -workspace example/ios/NotificationsExampleApp.xcworkspace -sdk iphonesimulator -configuration Debug -derivedDataPath example/ios/DerivedData/NotificationsExampleApp ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO"
25+
}
26+
},
27+
"configurations": {
28+
"ios.sim.release": {
29+
"device": "simulator",
30+
"app": "ios.release"
31+
},
32+
"ios.sim.debug": {
33+
"device": "simulator",
34+
"app": "ios.debug"
35+
}
36+
}
37+
}

e2e/Notifications.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const {elementByLabel} = Utils;
33

44
describe('Notifications', () => {
55
beforeEach(async () => {
6-
await device.relaunchApp({delete: true, permissions: {notifications: 'YES'}});
6+
await device.launchApp({delete: true, permissions: {notifications: 'YES'}});
77
});
88

99
describe('Foreground', () => {

e2e/config.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
2-
"setupTestFrameworkScriptFile" : "./init.js",
3-
"testEnvironment": "node",
4-
"bail": true,
2+
"maxWorkers": 1,
3+
"testEnvironment": "./environment",
4+
"testRunner": "jest-circus/runner",
5+
"testTimeout": 120000,
6+
"reporters": ["detox/runners/jest/streamlineReporter"],
57
"verbose": true
68
}

e2e/environment.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const {
2+
DetoxCircusEnvironment,
3+
SpecReporter,
4+
WorkerAssignReporter,
5+
} = require('detox/runners/jest-circus');
6+
7+
class CustomDetoxEnvironment extends DetoxCircusEnvironment {
8+
constructor(config, context) {
9+
super(config, context);
10+
11+
// Can be safely removed, if you are content with the default value (=300000ms)
12+
this.initTimeout = 300000;
13+
14+
// This takes care of generating status logs on a per-spec basis. By default, Jest only reports at file-level.
15+
// This is strictly optional.
16+
this.registerListeners({
17+
SpecReporter,
18+
WorkerAssignReporter,
19+
});
20+
}
21+
}
22+
23+
module.exports = CustomDetoxEnvironment;

example/android/build.gradle

+18-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22

33
buildscript {
44
ext {
5-
androidSdkVersion = 30
6-
androidMinSdkVersion = 21
5+
buildToolsVersion = "31.0.0"
6+
minSdkVersion = 21
7+
compileSdkVersion = 31
8+
targetSdkVersion = 31
9+
10+
if (System.properties['os.arch'] == "aarch64") {
11+
// For M1 Users we need to use the NDK 24 which added support for aarch64
12+
ndkVersion = "24.0.8215888"
13+
} else {
14+
// Otherwise we default to the side-by-side NDK version from AGP.
15+
ndkVersion = "21.4.7075529"
16+
}
17+
718
kotlinVersion = "1.3.61"
819
kotlinStdlib = "kotlin-stdlib-jdk8"
920
detoxKotlinVersion = kotlinVersion
@@ -13,9 +24,11 @@ buildscript {
1324
mavenCentral()
1425
}
1526
dependencies {
16-
classpath "com.android.tools.build:gradle:4.2.2"
17-
classpath "com.google.gms:google-services:4.3.3"
18-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
27+
classpath("com.android.tools.build:gradle:7.0.4")
28+
classpath("com.facebook.react:react-native-gradle-plugin")
29+
classpath("de.undercouch:gradle-download-task:4.1.2")
30+
classpath("com.google.gms:google-services:4.3.3")
31+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
1932
}
2033
}
2134

example/android/gradle.properties

+21-7
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,26 @@
1010
# Specifies the JVM arguments used for the daemon process.
1111
# The setting is particularly useful for tweaking memory settings.
1212
# Default value: -Xmx10248m -XX:MaxPermSize=256m
13-
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14-
15-
# When configured, Gradle will run in incubating parallel mode.
16-
# This option should only be used with decoupled projects. More details, visit
17-
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
13+
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
1914

15+
# AndroidX package structure to make it clearer which packages are bundled with the
16+
# Android operating system, and which are packaged with your app's APK
17+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
2018
android.useAndroidX=true
21-
android.enableJetifier=true
19+
# Automatically convert third-party libraries to use AndroidX
20+
android.enableJetifier=true
21+
22+
# Version of flipper SDK to use with React Native
23+
FLIPPER_VERSION=0.125.0
24+
25+
# Use this property to specify which architecture you want to build.
26+
# You can also override it from the CLI using
27+
# ./gradlew <task> -PreactNativeArchitectures=x86_64
28+
29+
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
30+
# Use this property to enable support to the new architecture.
31+
# This will allow you to use TurboModules and the Fabric render in
32+
# your application. You should enable this flag either if you want
33+
# to write custom TurboModules/Fabric components OR use libraries that
34+
# are providing them.
35+
newArchEnabled=false

example/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip

0 commit comments

Comments
 (0)