Open History to see the last commit
1import { ActivityIndicator, StatusBar, View } from "react-native";
2import { useSafeAreaInsets } from "react-native-safe-area-context";
3import { useThemeColor } from "../lib/useThemeColor";
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 readonly messagePlacement?: "above-spinner" | "below-spinner";
12}) {
13 const { themeAppearance: colorScheme } = useAppearancePreferences();
14 const screenBg = useThemeColor("--color-screen");
15 const insets = useSafeAreaInsets();
16 const messagePlacement = props.messagePlacement ?? "below-spinner";
17
18 return (
19 <View className="flex-1 bg-screen" style={{ paddingTop: insets.top }}>
20 <StatusBar
21 barStyle={colorScheme === "dark" ? "light-content" : "dark-content"}
22 backgroundColor={screenBg as string}
23 translucent
24 />
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 <ActivityIndicator 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}