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