Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: overflowing story content overlaps sidebar #627

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions packages/react-native-ui/src/Layout.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { Meta, StoryObj } from '@storybook/react';
import { Layout } from './Layout';
import { mockDataset } from './mockdata';
import { Text } from 'react-native';
import { Text, View } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
import { LayoutProvider } from './LayoutProvider';

const meta = {
title: 'components/Layout',
Expand All @@ -12,7 +13,9 @@ const meta = {
(Story) => (
<GestureHandlerRootView style={{ flex: 1 }}>
<BottomSheetModalProvider>
<Story />
<LayoutProvider>
<Story />
</LayoutProvider>
</BottomSheetModalProvider>
</GestureHandlerRootView>
),
Expand All @@ -31,3 +34,44 @@ export const Basic: Story = {
storyId: 'emails-buildnotification--with-changes',
},
};

export const OverflowSidebarExample: Story = {
args: {
children: (
<View
style={{
width: '100%',
backgroundColor: 'lightgreen',
alignItems: 'flex-end',
left: '-50%',
}}
>
<Text style={{ width: '50%', textAlign: 'right' }}>
This box should not overflow the side navigation in desktop mode
</Text>
</View>
),
//@ts-ignore
storyHash: mockDataset.withRoot,
storyId: 'emails-buildnotification--with-changes',
},
};

export const OverflowAddonsExample: Story = {
args: {
children: (
<View
style={{
height: '100%',
backgroundColor: 'lightgreen',
bottom: '-50%',
}}
>
<Text style={{ height: '50%' }}>This box should not overflow the addons panel</Text>
</View>
),
//@ts-ignore
storyHash: mockDataset.withRoot,
storyId: 'emails-buildnotification--with-changes',
},
};
4 changes: 2 additions & 2 deletions packages/react-native-ui/src/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const Layout = ({
</View>

<View style={{ flex: 1 }}>
<View style={{ flex: 1 }}>{children}</View>
<View style={{ flex: 1, overflow: 'hidden' }}>{children}</View>

<View
style={{
Expand Down Expand Up @@ -133,7 +133,7 @@ export const Layout = ({

return (
<View style={{ flex: 1, paddingTop: insets.top, backgroundColor: theme.background.content }}>
<View style={{ flex: 1 }}>{children}</View>
<View style={{ flex: 1, overflow: 'hidden' }}>{children}</View>

<MobileMenuDrawer ref={mobileMenuDrawerRef} onStateChange={setDrawerOpen}>
<View style={{ paddingLeft: 16, paddingTop: 4, paddingBottom: 4 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const StoryView = () => {

return (
<View
style={{ flex: 1, backgroundColor: theme.background?.content }}
style={{ flex: 1, backgroundColor: theme.background?.content, overflow: 'hidden' }}
key={id}
testID={id}
onStartShouldSetResponder={dismissOnStartResponder}
Expand Down