Skip to content

Commit 081800d

Browse files
committed
feat(web): support scrollable content
1 parent 25b9a4e commit 081800d

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/TrueSheet.web.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const TrueSheetComponent = forwardRef<TrueSheetMethods, TrueSheetProps>((props,
5858
headerStyle,
5959
footer,
6060
footerStyle,
61+
scrollable = false,
6162
onPositionChange,
6263
} = props;
6364

@@ -233,6 +234,8 @@ const TrueSheetComponent = forwardRef<TrueSheetMethods, TrueSheetProps>((props,
233234
left: 0,
234235
right: 0,
235236
bottom: 0,
237+
display: 'flex',
238+
flexDirection: 'column',
236239
borderTopLeftRadius: 16,
237240
borderTopRightRadius: 16,
238241
backgroundColor: backgroundColor as string,
@@ -299,7 +302,13 @@ const TrueSheetComponent = forwardRef<TrueSheetMethods, TrueSheetProps>((props,
299302
{isValidElement(header) ? header : createElement(header)}
300303
</View>
301304
)}
302-
<View style={style}>{children}</View>
305+
{scrollable ? (
306+
<div style={scrollableContainerStyle}>
307+
<View style={style}>{children}</View>
308+
</div>
309+
) : (
310+
<View style={style}>{children}</View>
311+
)}
303312
</Drawer.Content>
304313
{footer && (
305314
<div style={footerFloatStyle}>
@@ -319,6 +328,14 @@ const overlayStyle: React.CSSProperties = {
319328
backgroundColor: 'rgba(0, 0, 0, 0.5)',
320329
};
321330

331+
const scrollableContainerStyle: React.CSSProperties = {
332+
flex: 1,
333+
minHeight: 0,
334+
overflowY: 'auto',
335+
overscrollBehavior: 'contain',
336+
touchAction: 'pan-y',
337+
};
338+
322339
const visuallyHiddenStyle: React.CSSProperties = {
323340
position: 'absolute',
324341
width: 1,

0 commit comments

Comments
 (0)