Use Android 12 splashscreen API #7363
Replies: 3 comments 4 replies
-
Looks cool, I think moving to 31 can have some breaking changes. If we have a contributor who can add such a cool feature it would be nice, We will offer a helpful guide to make the process smoother and easier. |
Beta Was this translation helpful? Give feedback.
-
An effort was already made here, but was never finished. IMO this library could do with a section in the documentation about splash screens. |
Beta Was this translation helpful? Give feedback.
-
@fiznool Sure thing, so with the patch-package from that PR, here is an example of my MainActivity file that would load the splash screen. Besides this I think its just a matter of setting up the resources according to the Android guide. My project looks here if you want to see how those resources are placed https://github.com/zzorba/ArkhamCards. One thing to note, some of the Samsung versions on Android 12 won't always show the splash screen when you would expect them to (because of Samsung's custom launcher, which results in users getting a blank screen instead). I think this is a Samsung/Google disagreement, and I believe they fixed it in Android 13. But you might consider only enabling new-splash for 13+ if you have a large number of Samsung issues (they might have fixed this, but they hadn't 6 months ago).
|
Beta Was this translation helpful? Give feedback.
-
🚀 Feature
Android 12 has introduced a new SplashScreen API, with an AndroidX compat library for older versions. In a nutshell, this allows developers to hook up an animatable splash screen, and provides an API for dismissing the splash screen when the app is ready to be used.
If this library were to use the new SplashScreen API, apps using RNN could add splash screen support quite easily.
Motivation
From the Android docs:
Pitch
Changes to RNN codebase (mostly as per these Android docs):
compileSdkVersion
should be set to 31.'androidx.core:core-splashscreen:1.0.0-alpha01'
should be added as a dependency tobuild.gradle
.onCreate
method inNavigationActivity.java
should be updated as follows:SplashScreen.installSplashScreen(this)
.The splash screen will be automatically dismissed when the app draws its first frame, so providing this happens when the React Native side calls
Navigation.setRoot
, the splash screen will remain until this time.Changes to documentation:
android/app/src/main/res/values/styles.xml
which extendsTheme.SplashScreen
postSplashScreenTheme
value to the mainAppTheme
AndroidManifest.xml
so that theMainApplication
theme is this new splash themeAre you willing to resolve this issue by submitting a Pull Request?
Beta Was this translation helpful? Give feedback.
All reactions