Skip to content

Commit bd7f101

Browse files
committed
chore(example): update example to use latest expo sdk
1 parent 7246d6a commit bd7f101

File tree

18 files changed

+3105
-1006
lines changed

18 files changed

+3105
-1006
lines changed

example/android/app/build.gradle

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ react {
6464
}
6565

6666
/**
67-
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
67+
* Set this to true in release builds to optimize the app using [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization).
6868
*/
69-
def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean()
69+
def enableMinifyInReleaseBuilds = (findProperty('android.enableMinifyInReleaseBuilds') ?: false).toBoolean()
7070

7171
/**
7272
* The preferred build flavor of JavaScriptCore (JSC)
@@ -94,6 +94,8 @@ android {
9494
targetSdkVersion rootProject.ext.targetSdkVersion
9595
versionCode 1
9696
versionName "1.0.0"
97+
98+
buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
9799
}
98100
signingConfigs {
99101
debug {
@@ -111,15 +113,18 @@ android {
111113
// Caution! In production, you need to generate your own keystore file.
112114
// see https://reactnative.dev/docs/signed-apk-android.
113115
signingConfig signingConfigs.debug
114-
shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false)
115-
minifyEnabled enableProguardInReleaseBuilds
116+
def enableShrinkResources = findProperty('android.enableShrinkResourcesInReleaseBuilds') ?: 'false'
117+
shrinkResources enableShrinkResources.toBoolean()
118+
minifyEnabled enableMinifyInReleaseBuilds
116119
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
117-
crunchPngs (findProperty('android.enablePngCrunchInReleaseBuilds')?.toBoolean() ?: true)
120+
def enablePngCrunchInRelease = findProperty('android.enablePngCrunchInReleaseBuilds') ?: 'true'
121+
crunchPngs enablePngCrunchInRelease.toBoolean()
118122
}
119123
}
120124
packagingOptions {
121125
jniLibs {
122-
useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
126+
def enableLegacyPackaging = findProperty('expo.useLegacyPackaging') ?: 'false'
127+
useLegacyPackaging enableLegacyPackaging.toBoolean()
123128
}
124129
}
125130
androidResources {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
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:supportsRtl="true">
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:supportsRtl="true" android:enableOnBackInvokedCallback="false">
1515
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
1616
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
1717
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>

example/android/app/src/main/java/com/roberteggl/example/MainApplication.kt

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,33 @@ import android.content.res.Configuration
55

66
import com.facebook.react.PackageList
77
import com.facebook.react.ReactApplication
8+
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
89
import com.facebook.react.ReactNativeHost
910
import com.facebook.react.ReactPackage
1011
import com.facebook.react.ReactHost
11-
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
12+
import com.facebook.react.common.ReleaseLevel
13+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint
1214
import com.facebook.react.defaults.DefaultReactNativeHost
13-
import com.facebook.react.soloader.OpenSourceMergedSoMapping
14-
import com.facebook.soloader.SoLoader
1515

1616
import expo.modules.ApplicationLifecycleDispatcher
1717
import expo.modules.ReactNativeHostWrapper
1818

1919
class MainApplication : Application(), ReactApplication {
2020

2121
override val reactNativeHost: ReactNativeHost = ReactNativeHostWrapper(
22-
this,
23-
object : DefaultReactNativeHost(this) {
24-
override fun getPackages(): List<ReactPackage> {
25-
val packages = PackageList(this).packages
26-
// Packages that cannot be autolinked yet can be added manually here, for example:
27-
// packages.add(MyReactNativePackage())
28-
return packages
29-
}
22+
this,
23+
object : DefaultReactNativeHost(this) {
24+
override fun getPackages(): List<ReactPackage> =
25+
PackageList(this).packages.apply {
26+
// Packages that cannot be autolinked yet can be added manually here, for example:
27+
// add(MyReactNativePackage())
28+
}
3029

3130
override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry"
3231

3332
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
3433

3534
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
36-
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
3735
}
3836
)
3937

@@ -42,11 +40,12 @@ class MainApplication : Application(), ReactApplication {
4240

4341
override fun onCreate() {
4442
super.onCreate()
45-
SoLoader.init(this, OpenSourceMergedSoMapping)
46-
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
47-
// If you opted-in for the New Architecture, we load the native entry point for this app.
48-
load()
43+
DefaultNewArchitectureEntryPoint.releaseLevel = try {
44+
ReleaseLevel.valueOf(BuildConfig.REACT_NATIVE_RELEASE_LEVEL.uppercase())
45+
} catch (e: IllegalArgumentException) {
46+
ReleaseLevel.STABLE
4947
}
48+
loadReactNative(this)
5049
ApplicationLifecycleDispatcher.onApplicationCreate(this)
5150
}
5251

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<resources xmlns:tools="http://schemas.android.com/tools">
2-
<style name="AppTheme" parent="Theme.EdgeToEdge">
2+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
3+
<item name="android:enforceNavigationBarContrast" tools:targetApi="29">true</item>
34
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
45
<item name="colorPrimary">@color/colorPrimary</item>
56
<item name="android:statusBarColor">#ffffff</item>
@@ -8,5 +9,6 @@
89
<item name="windowSplashScreenBackground">@color/splashscreen_background</item>
910
<item name="windowSplashScreenAnimatedIcon">@drawable/splashscreen_logo</item>
1011
<item name="postSplashScreenTheme">@style/AppTheme</item>
12+
<item name="android:windowSplashScreenBehavior">icon_preferred</item>
1113
</style>
1214
</resources>

example/android/build.gradle

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,8 @@ buildscript {
1212
}
1313
}
1414

15-
def reactNativeAndroidDir = new File(
16-
providers.exec {
17-
workingDir(rootDir)
18-
commandLine("node", "--print", "require.resolve('react-native/package.json')")
19-
}.standardOutput.asText.get().trim(),
20-
"../android"
21-
)
22-
2315
allprojects {
2416
repositories {
25-
maven {
26-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
27-
url(reactNativeAndroidDir)
28-
}
29-
3017
google()
3118
mavenCentral()
3219
maven { url 'https://www.jitpack.io' }

example/android/gradle.properties

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18-
# org.gradle.parallel=true
18+
org.gradle.parallel=true
1919

2020
# AndroidX package structure to make it clearer which packages are bundled with the
2121
# Android operating system, and which are packaged with your app's APK
@@ -41,6 +41,11 @@ newArchEnabled=true
4141
# If set to false, you will be using JSC instead.
4242
hermesEnabled=true
4343

44+
# Use this property to enable edge-to-edge display support.
45+
# This allows your app to draw behind system bars for an immersive UI.
46+
# Note: Only works with ReactActivity and should not be used with custom Activity.
47+
edgeToEdgeEnabled=true
48+
4449
# Enable GIF support in React Native images (~200 B increase)
4550
expo.gif.enabled=true
4651
# Enable webp support in React Native images (~85 KB increase)
@@ -55,5 +60,6 @@ EX_DEV_CLIENT_NETWORK_INSPECTOR=true
5560
# Use legacy packaging to compress native libraries in the resulting APK.
5661
expo.useLegacyPackaging=false
5762

58-
# Whether the app is configured to use edge-to-edge via the app config or `react-native-edge-to-edge` plugin
59-
expo.edgeToEdgeEnabled=true
63+
# Specifies whether the app is configured to use edge-to-edge via the app config or plugin
64+
# WARNING: This property has been deprecated and will be removed in Expo SDK 55. Use `edgeToEdgeEnabled` or `react.edgeToEdgeEnabled` to determine whether the project is using edge-to-edge.
65+
expo.edgeToEdgeEnabled=true
181 Bytes
Binary file not shown.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

example/android/gradlew

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117+
CLASSPATH="\\\"\\\""
118118

119119

120120
# Determine the Java command to use to start the JVM.
@@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
213213
set -- \
214214
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215215
-classpath "$CLASSPATH" \
216-
org.gradle.wrapper.GradleWrapperMain \
216+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217217
"$@"
218218

219219
# Stop when "xargs" is not available.

example/android/gradlew.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73+
set CLASSPATH=
7474

7575

7676
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
77+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7878

7979
:end
8080
@rem End local scope for the variables with windows NT shell

0 commit comments

Comments
 (0)