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