Add the desktop scaffold

This commit is contained in:
2024-01-06 14:38:47 +01:00
committed by Clément Le Bihan
parent fa60fc65a9
commit a3659618ea
5 changed files with 146 additions and 183 deletions
+20 -7
View File
@@ -18,6 +18,8 @@ import type {
import { BottomTabView } from '@react-navigation/bottom-tabs';
import ScaffoldMobileCC from '../components/UI/ScaffoldMobileCC';
import { useBreakpointValue } from 'native-base';
import ScaffoldDesktopCC from '../components/UI/ScaffoldDesktopCC';
type Props = DefaultNavigatorOptions<
ParamListBase,
@@ -56,15 +58,26 @@ function BottomTabNavigator({
screenOptions,
});
const screenSize = useBreakpointValue({ base: 'small', md: 'big' });
return (
<NavigationContent>
<BottomTabView
{...rest}
state={state}
navigation={navigation}
descriptors={descriptors}
sceneContainerStyle={sceneContainerStyle}
/>
{screenSize === 'small' ? (
<BottomTabView
tabBar={ScaffoldMobileCC}
{...rest}
state={state}
navigation={navigation}
descriptors={descriptors}
sceneContainerStyle={sceneContainerStyle}
/>
) : (
<ScaffoldDesktopCC
state={state}
navigation={navigation}
descriptors={descriptors}>
{descriptors[state.routes[state.index]!.key]!.render()}
</ScaffoldDesktopCC>
)}
</NavigationContent>
);
}