Skip to content

Commit 32b0ee7

Browse files
authored
chore: upgrade to Expo 50 (#27)
1 parent 4d166fa commit 32b0ee7

32 files changed

+4322
-5558
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.18.1
1+
20.11.1

example/android/app/build.gradle

Lines changed: 21 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "org.jetbrains.kotlin.android"
23
apply plugin: "com.facebook.react"
34

4-
import com.android.build.OutputFile
5-
65
def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
7-
def expoDebuggableVariants = ['debug']
8-
// Override `debuggableVariants` for expo-updates debugging
9-
if (System.getenv('EX_UPDATES_NATIVE_DEBUG') == "1") {
10-
react {
11-
expoDebuggableVariants = []
12-
}
13-
}
14-
156

167
/**
178
* This is the configuration block to customize your React Native Android app.
@@ -21,17 +12,21 @@ react {
2112
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
2213
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
2314
hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
24-
debuggableVariants = expoDebuggableVariants
15+
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
16+
17+
// Use Expo CLI to bundle the app, this ensures the Metro config
18+
// works correctly with Expo projects.
19+
cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
20+
bundleCommand = "export:embed"
2521

2622
/* Folders */
2723
// The root of your project, i.e. where "package.json" lives. Default is '..'
2824
// root = file("../")
2925
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
3026
// reactNativeDir = file("../node_modules/react-native")
31-
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
32-
// codegenDir = file("../node_modules/react-native-codegen")
33-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
34-
// cliFile = file("../node_modules/react-native/cli.js")
27+
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
28+
// codegenDir = file("../node_modules/@react-native/codegen")
29+
3530

3631
/* Variants */
3732
// The list of variants to that are debuggable. For those we're going to
@@ -43,9 +38,6 @@ react {
4338
// A list containing the node command and its flags. Default is just 'node'.
4439
// nodeExecutableAndArgs = ["node"]
4540
//
46-
// The command to run when bundling. By default is 'bundle'
47-
// bundleCommand = "ram-bundle"
48-
//
4941
// The path to the CLI configuration file. Default is empty.
5042
// bundleConfig = file(../rn-cli.config.js)
5143
//
@@ -67,19 +59,6 @@ react {
6759
// hermesFlags = ["-O", "-output-source-map"]
6860
}
6961

70-
// Override `hermesEnabled` by `expo.jsEngine`
71-
ext {
72-
hermesEnabled = (findProperty('expo.jsEngine') ?: "hermes") == "hermes"
73-
}
74-
75-
/**
76-
* Set this to true to create four separate APKs instead of one,
77-
* one for each native architecture. This is useful if you don't
78-
* use App Bundles (https://developer.android.com/guide/app-bundle/)
79-
* and want to have separate APKs to upload to the Play Store.
80-
*/
81-
def enableSeparateBuildPerCPUArchitecture = false
82-
8362
/**
8463
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
8564
*/
@@ -98,20 +77,11 @@ def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInRelea
9877
*/
9978
def jscFlavor = 'org.webkit:android-jsc:+'
10079

101-
/**
102-
* Private function to get the list of Native Architectures you want to build.
103-
* This reads the value from reactNativeArchitectures in your gradle.properties
104-
* file and works together with the --active-arch-only flag of react-native run-android.
105-
*/
106-
def reactNativeArchitectures() {
107-
def value = project.getProperties().get("reactNativeArchitectures")
108-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
109-
}
110-
11180
android {
11281
ndkVersion rootProject.ext.ndkVersion
11382

114-
compileSdkVersion rootProject.ext.compileSdkVersion
83+
buildToolsVersion rootProject.ext.buildToolsVersion
84+
compileSdk rootProject.ext.compileSdkVersion
11585

11686
namespace 'com.rnh.example'
11787
defaultConfig {
@@ -120,16 +90,9 @@ android {
12090
targetSdkVersion rootProject.ext.targetSdkVersion
12191
versionCode 1
12292
versionName "1.0.0"
93+
buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
12394
}
12495

125-
splits {
126-
abi {
127-
reset()
128-
enable enableSeparateBuildPerCPUArchitecture
129-
universalApk false // If true, also generate a universal APK
130-
include (*reactNativeArchitectures())
131-
}
132-
}
13396
signingConfigs {
13497
debug {
13598
storeFile file('debug.keystore')
@@ -151,19 +114,9 @@ android {
151114
}
152115
}
153116

154-
// applicationVariants are e.g. debug, release
155-
applicationVariants.all { variant ->
156-
variant.outputs.each { output ->
157-
// For each separate APK per architecture, set a unique version code as described here:
158-
// https://developer.android.com/studio/build/configure-apk-splits.html
159-
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
160-
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
161-
def abi = output.getFilter(OutputFile.ABI)
162-
if (abi != null) { // null for the universal-debug, universal-release variants
163-
output.versionCodeOverride =
164-
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
165-
}
166-
117+
packagingOptions {
118+
jniLibs {
119+
useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
167120
}
168121
}
169122
}
@@ -195,35 +148,22 @@ dependencies {
195148
def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
196149
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
197150
def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
198-
def frescoVersion = rootProject.ext.frescoVersion
199-
200-
// If your app supports Android versions before Ice Cream Sandwich (API level 14)
201-
if (isGifEnabled || isWebpEnabled) {
202-
implementation("com.facebook.fresco:fresco:${frescoVersion}")
203-
implementation("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}")
204-
}
205151

206152
if (isGifEnabled) {
207153
// For animated gif support
208-
implementation("com.facebook.fresco:animated-gif:${frescoVersion}")
154+
implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}")
209155
}
210156

211157
if (isWebpEnabled) {
212158
// For webp support
213-
implementation("com.facebook.fresco:webpsupport:${frescoVersion}")
159+
implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}")
214160
if (isWebpAnimatedEnabled) {
215161
// Animated webp support
216-
implementation("com.facebook.fresco:animated-webp:${frescoVersion}")
162+
implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}")
217163
}
218164
}
219165

220-
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
221-
222-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
223-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
224-
exclude group:'com.squareup.okhttp3', module:'okhttp'
225-
}
226-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
166+
implementation("com.facebook.react:flipper-integration")
227167

228168
if (hermesEnabled.toBoolean()) {
229169
implementation("com.facebook.react:hermes-android")
@@ -232,5 +172,5 @@ dependencies {
232172
}
233173
}
234174

235-
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
175+
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
236176
applyNativeModulesAppBuildGradle(project)

example/android/app/src/debug/java/com/rnh/example/ReactNativeFlipper.java

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

example/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
<data android:scheme="https"/>
1212
</intent>
1313
</queries>
14-
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
14+
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme">
1515
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
1616
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="48.0.0"/>
1717
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
1818
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
1919
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@anonymous/example"/>
20-
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="unspecified">
20+
<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true">
2121
<intent-filter>
2222
<action android:name="android.intent.action.MAIN"/>
2323
<category android:name="android.intent.category.LAUNCHER"/>

example/android/app/src/main/java/com/rnh/example/MainActivity.java

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

0 commit comments

Comments
 (0)