Skip to content

Commit

Permalink
[@mantine/core] ScrollArea: Fix viewport onScroll prop not working
Browse files Browse the repository at this point in the history
  • Loading branch information
zo-ly committed Apr 9, 2024
1 parent 4c9a875 commit 6c52495
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/@mantine/core/src/components/ScrollArea/ScrollArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,13 @@ export const ScrollArea = factory<ScrollAreaFactory>((_props, ref) => {
ref={viewportRef}
data-offset-scrollbars={offsetScrollbars === true ? 'xy' : offsetScrollbars || undefined}
data-scrollbars={scrollbars || undefined}
onScroll={
typeof onScrollPositionChange === 'function'
? ({ currentTarget }) =>
onScrollPositionChange({
x: currentTarget.scrollLeft,
y: currentTarget.scrollTop,
})
: undefined
onScroll={(e) => {
viewportProps?.onScroll?.(e);
onScrollPositionChange?.({
x: e.currentTarget.scrollLeft,
y: e.currentTarget.scrollTop,
});
}
}
>
{children}
Expand Down

0 comments on commit 6c52495

Please sign in to comment.