LynxSplashScreen
Keeps the app's splash screen up until the app's first screen is ready, then fades it out. import { LynxSplashScreen, provideSplashScreen, type SplashScreenOptions, type SplashScreenHide } from '@blotch/angular-lynx';
Set it up in angular.json
The splash screen's image and color come from the build target's splash option:
Without an image, iOS shows the color alone, and Android the app's icon. The splash screen covers every field, and dark mode.
Usage
An app whose first screen waits on something other than the router hides it itself:
The phone takes a splash screen down as soon as the app draws its first frame. In an AngularLynx app that frame would be empty:
- The app hasn't run yet.
- Its first screen may have work to do before it can draw, such as restoring a signed-in session from
LynxSecureStorage, or running a lazy route's guard.
So the apps ng build --platform makes keep it up until the app hides it here.
API
provideSplashScreen()
Says when the splash screen goes. Without it, it goes at the first frame Angular draws.
With 'afterFirstNavigation':
- The navigation ends once its guards and resolvers have run, and its lazy routes have loaded.
- A guard's redirect is followed to the screen it leads to.
- A navigation that fails ends it too.
- It needs the router: it throws without
provideRouter().
LynxSplashScreen
After five seconds, the apps take the splash screen down anyway, whether or not the app has hidden it. So a first screen that never settles can't leave the app behind its logo.
Related
- The splash screen: the
splashoption - Splash screen example
- Know when the first screen is drawn, in an app of your own
