-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
🚀 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.
- Have you read the Contributing Guidelines on issues?
Motivation
From the Android docs:
If you do not migrate your app [to the new SplashScreen API], your app launch experience on Android 12 and higher will be either degraded or may have unintended results
Pitch
Changes to RNN codebase (mostly as per these Android docs):
compileSdkVersionshould be set to 31.'androidx.core:core-splashscreen:1.0.0-alpha01'should be added as a dependency tobuild.gradle.- New documentation should be added to guide developers on adding the necessary splash screen assets.
- The
onCreatemethod inNavigationActivity.javashould be updated as follows:- Install the splash screen:
SplashScreen.installSplashScreen(this).
- Install the splash screen:
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:
- Section added on how to customise the Android splash screen. By default, the splash screen will consist of the launcher icon, centered in the screen, with a white background. This can be customised according to the Android docs, briefly the following needs to be done:
- Create a new theme in
android/app/src/main/res/values/styles.xmlwhich extendsTheme.SplashScreen - Add the necessary details here to customise the icon, animation etc.
- Set the
postSplashScreenThemevalue to the mainAppTheme - Update
AndroidManifest.xmlso that theMainApplicationtheme is this new splash theme
- Create a new theme in
- Section added on how to customise the exit animation of the splash screen, as per the Android docs
Are you willing to resolve this issue by submitting a Pull Request?
- ✅ Yes, I have the time, and I know how to start.
- ✖️ Yes, I have the time, but I don't know how to start. I would need guidance.
- ✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.