Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

SettingsScreen.tsx

36 lines1.1 KB

1import { useNavigation } from "@react-navigation/native";
2import type { ReactNode } from "react";
3import { Platform, View } from "react-native";
4​
5import type { AppBarProps } from "../../../components/ui/AppBar.types";
6import { AppBar } from "../../../components/ui/AppBar";
7import { ScreenContent as SettingsScreenContent } from "../../../components/ui/ScreenContent";
8​
9export { SettingsScreenContent };
10​
11export function SettingsScreen(
12 props: Pick<AppBarProps, "title" | "actions" | "trailing"> & {
13 readonly children: ReactNode;
14 readonly formSheet?: boolean;
15 },
16) {
17 const navigation = useNavigation();
18​
19 return (
20 <View collapsable={false} className="flex-1 bg-sheet">
21 <AppBar
22 title={props.title}
23 actions={props.actions}
24 trailing={Platform.OS === "android" ? props.trailing : undefined}
25 sidebar={false}
26 onBack={() => navigation.goBack()}
27 hideBottomBorder={!props.formSheet}
28 />
29 {props.formSheet ? (
30 props.children
31 ) : (
32 <SettingsScreenContent>{props.children}</SettingsScreenContent>
33 )}
34 </View>
35 );