aboutsummaryrefslogtreecommitdiffstats
path: root/apps/mobile/components/ui/CustomSafeAreaView.tsx
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-03-29 14:17:36 +0000
committerMohamedBassem <me@mbassem.com>2024-03-29 14:17:36 +0000
commit26b53e2ccc00befd182c4af05ab52fc439be7535 (patch)
tree6697b977daecd0e43be15d9e34dd9f8cbf30472b /apps/mobile/components/ui/CustomSafeAreaView.tsx
parent2cfb7cb27f3825b8c8656d8b8649bd22fa52bfbf (diff)
downloadkarakeep-26b53e2ccc00befd182c4af05ab52fc439be7535.tar.zst
mobile(android): Getting the android app ready for submission
Diffstat (limited to 'apps/mobile/components/ui/CustomSafeAreaView.tsx')
-rw-r--r--apps/mobile/components/ui/CustomSafeAreaView.tsx28
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/mobile/components/ui/CustomSafeAreaView.tsx b/apps/mobile/components/ui/CustomSafeAreaView.tsx
new file mode 100644
index 00000000..c97dfe72
--- /dev/null
+++ b/apps/mobile/components/ui/CustomSafeAreaView.tsx
@@ -0,0 +1,28 @@
+import { Platform, SafeAreaView } from "react-native";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
+import { useHeaderHeight } from "@react-navigation/elements";
+
+export default function CustomSafeAreaView({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ const insets = useSafeAreaInsets();
+ const headerHeight = useHeaderHeight();
+
+ return (
+ <SafeAreaView
+ style={{
+ paddingTop:
+ // Some ugly hacks to make the app look the same on both android and ios
+ Platform.OS == "android"
+ ? headerHeight > 0
+ ? headerHeight
+ : insets.top
+ : undefined,
+ }}
+ >
+ {children}
+ </SafeAreaView>
+ );
+}