1import { StatusBar, View } from "react-native";
2import { useSafeAreaInsets } from "react-native-safe-area-context";
3import { AppActivityIndicator } from "./AppActivityIndicator";
4import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
5
6import { AppText as Text } from "./AppText";
7import { BrandMark } from "./BrandMark";
8
9export function LoadingScreen(props: {
10 readonly message: string;
11 /** Let the enclosing pane supply the background and top inset. */
12 readonly embedded?: boolean;
13 readonly messagePlacement?: "above-spinner" | "below-spinner";
14}) {
15 const { themeAppearance: colorScheme } = useAppearancePreferences();
16 const insets = useSafeAreaInsets();
17 const messagePlacement = props.messagePlacement ?? "below-spinner";
18
19 return (
20 <View
21 className={props.embedded ? "flex-1" : "flex-1 bg-screen"}
22 style={{ paddingTop: props.embedded ? 0 : insets.top }}
23 >
24 <StatusBar barStyle={colorScheme === "dark" ? "light-content" : "dark-content"} />
25 <View className="flex-1 items-center justify-center gap-5 px-6">
26 <BrandMark compact />
27 {messagePlacement === "above-spinner" ? (
28 <Text className="font-t3-bold text-lg text-foreground">{props.message}</Text>
29 ) : null}
30 <AppActivityIndicator size="large" />
31 {messagePlacement === "below-spinner" ? (
32 <Text className="font-t3-bold text-lg text-foreground">{props.message}</Text>
33 ) : null}
34 </View>
35 </View>
36 );
37}