Command palette

@yasinsensoy/native

React Native · Components

SplashScreen

A splash screen you design with your own components.

4 exports

Import

import { SplashScreen, Splash } from "@yasinsensoy/native";

SplashScreen

component

A splash screen you design with your own components. The native splash screen (ui.config splash, preferably only a background color) closes unnoticed the moment this component first renders; then your design shows and leaves with an animation once ready. Render it at the app root, inside UIProvider and above everything else (last child).

On Android 12+ the system shows a short starting window on every launch; it cannot be disabled, but with an image-less setting (splash: { background: "#0b0b14" }) it is just a plain color and blends seamlessly with this component.

SplashScreen({ ready, minDuration, exit, exitDuration, background, children, onHidden, style, }: SplashScreenProps): JSX.Element | null

Examples

<UIProvider>
  <App />
  <SplashScreen ready={sessionLoaded} minDuration={600} exit="scale" background="#0b0b14">
    <Logo />
    <Text>Welcome</Text>
  </SplashScreen>
</UIProvider>

Splash

module

Splash screen.

NameTypeDescription
isVisible() => booleanWhether the splash screen is still visible.
hide(options?: { duration?: number; }) => Promise<void>Closes the splash screen; fading on both platforms (duration ms, default 200; 0 immediately).

Exit animation.

type SplashExit = "fade" | "scale" | "slide-up" | "none"

SplashScreen props.

NameTypeDefaultDescription
ready?booleantrueThe app is ready (data loaded): the screen leaves with the exit animation.
minDuration?number0Minimum visible duration (ms; so the animation can finish).
exit?SplashExit"fade"
exitDuration?number300Exit duration (ms).
background?stringthe theme backgroundBackground; give it the same color as the native splash screen so the transition is invisible.
children?ReactNode | ((exit: Animated.Value) => ReactNode)Your design: logo, text, your own animation. With a function, the exit progress (0 → 1) arrives as an Animated.Value.
onHidden?() => voidWhen the screen has fully left.
style?StyleProp<ViewStyle>Style of the root view.