From 17a4328af55c273efc5526affafd00cf1eec42c9 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 6 Jan 2024 16:49:57 +0100 Subject: [PATCH] Better safe area handling everywhere --- front/Navigation.tsx | 8 +++++++- front/utils/navigator.tsx | 21 ++------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/front/Navigation.tsx b/front/Navigation.tsx index 9e31343..6e4ea5c 100644 --- a/front/Navigation.tsx +++ b/front/Navigation.tsx @@ -39,6 +39,7 @@ import ScaffoldMobileCC from './components/UI/ScaffoldMobileCC'; import ScaffoldDesktopCC from './components/UI/ScaffoldDesktopCC'; import { createCustomNavigator } from './utils/navigator'; import { Cup, Discover, Music, SearchNormal1, Setting2, User } from 'iconsax-react-native'; +import { useSafeAreaInsets } from 'react-native-safe-area-context'; const Stack = createNativeStackNavigator(); const Tab = createCustomNavigator(); @@ -182,12 +183,17 @@ type AppRouteParams = PrivateRoutesParams & PublicRoutesParams; const RouteToScreen = (Component: Route['component']) => function Route(props: NativeStackScreenProps) { const colorScheme = useColorScheme(); + const insets = useSafeAreaInsets(); return ( @@ -301,7 +307,7 @@ export const Router = () => { fallback={} theme={colorScheme == 'light' ? DefaultTheme : DarkTheme} > - + {authStatus == 'error' ? ( <> {screenSize === 'small' ? ( @@ -91,26 +88,12 @@ function BottomTabNavigator({ sceneContainerStyle, { backgroundColor: 'transparent', - paddingTop: insets.top, - paddingLeft: insets.left, - paddingRight: insets.right, - // Keep some margin with the tabbar (insets already applied there) paddingBottom: 8, }, ]} /> ) : ( - +