blob: 33c9a765bbb131ba7ddf8a98a8be3b24d89e4d59 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { SafeAreaView } from "react-native-safe-area-context";
import { useHeaderHeight } from "@react-navigation/elements";
export default function CustomSafeAreaView({
children,
edges = ["top", "bottom"],
}: {
children: React.ReactNode;
edges?: ("top" | "bottom")[];
}) {
const headerHeight = useHeaderHeight();
return (
<SafeAreaView
style={{
flex: 1,
paddingTop: edges.includes("top")
? headerHeight > 0
? headerHeight
: undefined
: undefined,
}}
>
{children}
</SafeAreaView>
);
}
|