Skip to content

Commit

Permalink
chore(example): remove menu from pages without menu (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrebam authored Feb 12, 2024
1 parent 9588f16 commit 305675e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
65 changes: 33 additions & 32 deletions packages/example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,24 @@ const RenderMenu = (props: BottomTabBarProps) => <Menu {...props} />;

const TabNavigator = () => {
return (
<Tab.Navigator
screenOptions={{
headerShown: false,
}}
initialRouteName="Home"
tabBar={RenderMenu}
sceneContainerStyle={{
marginLeft: theme.sizes.menu.closed,
backgroundColor: theme.colors.background.main,
}}
>
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="ProgramGridPage" component={ProgramGridPage} />
<Tab.Screen name="NonVirtualizedGridPage" component={NonVirtualizedGridPage} />
<Tab.Screen name="GridWithLongNodesPage" component={GridWithLongNodesPage} />
</Tab.Navigator>
<MenuProvider>
<Tab.Navigator
screenOptions={{
headerShown: false,
}}
initialRouteName="Home"
tabBar={RenderMenu}
sceneContainerStyle={{
marginLeft: theme.sizes.menu.closed,
backgroundColor: theme.colors.background.main,
}}
>
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="ProgramGridPage" component={ProgramGridPage} />
<Tab.Screen name="NonVirtualizedGridPage" component={NonVirtualizedGridPage} />
<Tab.Screen name="GridWithLongNodesPage" component={GridWithLongNodesPage} />
</Tab.Navigator>
</MenuProvider>
);
};

Expand All @@ -67,22 +69,21 @@ function App(): JSX.Element {
<NavigationContainer>
<ThemeProvider theme={theme}>
<GoBackConfiguration />
<MenuProvider>
<Container width={width} height={height}>
<Stack.Navigator
screenOptions={{
headerShown: false,
contentStyle: {
backgroundColor: theme.colors.background.main,
},
}}
initialRouteName="TabNavigator"
>
<Stack.Screen name="TabNavigator" component={TabNavigator} />
<Stack.Screen name="ProgramDetail" component={ProgramDetail} />
</Stack.Navigator>
</Container>
</MenuProvider>

<Container width={width} height={height}>
<Stack.Navigator
screenOptions={{
headerShown: false,
contentStyle: {
backgroundColor: theme.colors.background.main,
},
}}
initialRouteName="TabNavigator"
>
<Stack.Screen name="TabNavigator" component={TabNavigator} />
<Stack.Screen name="ProgramDetail" component={ProgramDetail} />
</Stack.Navigator>
</Container>
</ThemeProvider>
</NavigationContainer>
);
Expand Down
4 changes: 1 addition & 3 deletions packages/example/src/components/Menu/MenuContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { createContext, useContext, useMemo, useState } from 'react';

const MenuContext = createContext<{ isOpen: boolean; toggleMenu: (isOpen: boolean) => void }>({
isOpen: false,
toggleMenu: () => {
throw new Error('MenuContext not initialized');
},
toggleMenu: () => {},
});

export const MenuProvider = ({ children }: { children: React.ReactNode }) => {
Expand Down

0 comments on commit 305675e

Please sign in to comment.