Skip to content

Commit

Permalink
[FIX] Horizontal scrollbar not showing on tables (#21852)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriellsh authored May 10, 2021
1 parent 2760fa9 commit 82243ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/components/GenericTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const GenericTable = (
) : (
<>
<Box mi='neg-x24' pi='x24' flexShrink={1} flexGrow={1} ref={ref} overflow='hidden'>
<ScrollableContentWrapper>
<ScrollableContentWrapper overflowX>
<Table fixed={fixed} sticky>
{header && (
<Table.Head>
Expand Down
13 changes: 9 additions & 4 deletions client/components/ScrollableContentWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const styleDefault = {
};

export type CustomScrollbarsProps = {
overflowX?: boolean;
style?: CSSProperties;
children?: ReactNode;
onScroll?: (values: ScrollValues) => void;
Expand All @@ -26,7 +27,7 @@ export type CustomScrollbarsProps = {
};

const ScrollableContentWrapper = forwardRef<HTMLElement, CustomScrollbarsProps>(
function WrappedComponent({ children, style, onScroll, renderView }, ref) {
function WrappedComponent({ children, style, onScroll, overflowX, renderView }, ref) {
const scrollbarsStyle = useMemo(() => ({ ...style, ...styleDefault }), [
style,
]) as CSSProperties;
Expand All @@ -39,9 +40,13 @@ const ScrollableContentWrapper = forwardRef<HTMLElement, CustomScrollbarsProps>(
style={scrollbarsStyle}
onScrollFrame={onScroll}
renderView={renderView}
renderTrackHorizontal={(props): ReactElement => (
<div {...props} className='track-horizontal' style={{ display: 'none' }} />
)}
renderTrackHorizontal={
overflowX
? undefined
: (props): ReactElement => (
<div {...props} className='track-horizontal' style={{ display: 'none' }} />
)
}
renderThumbVertical={({ style, ...props }): JSX.Element => (
<div
{...props}
Expand Down

0 comments on commit 82243ad

Please sign in to comment.