Skip to content

Commit 883d638

Browse files
committed
remove ScrollingComponent.defaultProps. we have changed it to a function, and the default props are already handled.
1 parent 8d5f6bd commit 883d638

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/index.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const defaultOptions = {
6161
strengthMultiplier: 30
6262
};
6363

64-
export function useDndScrolling(componentRef, passedOptions) {
64+
export function useDndScrolling(componentRef, scrollingOptions) {
6565
const { dragDropManager } = useContext(DndContext);
6666
if (!dragDropManager) {
6767
throw new Error(
@@ -73,14 +73,14 @@ export function useDndScrolling(componentRef, passedOptions) {
7373
if (!componentRef.current) {
7474
return () => {};
7575
}
76-
const options = { ...defaultOptions, ...passedOptions };
76+
const options = { ...defaultOptions, ...scrollingOptions };
7777
const monitor = new ScrollingMonitor(dragDropManager, componentRef.current, options);
7878
monitor.start();
7979
return () => {
8080
monitor.stop();
8181
};
8282
// eslint-disable-next-line react-hooks/exhaustive-deps
83-
}, [componentRef.current, dragDropManager, passedOptions]);
83+
}, [componentRef.current, dragDropManager, scrollingOptions]);
8484
}
8585

8686
export default function withScrolling(WrappedComponent) {
@@ -90,7 +90,7 @@ export default function withScrolling(WrappedComponent) {
9090
horizontalStrength,
9191
onScrollChange,
9292

93-
...passedProps
93+
...restProps
9494
}) {
9595
const ref = useRef(null);
9696
useDndScrolling(ref, {
@@ -100,7 +100,7 @@ export default function withScrolling(WrappedComponent) {
100100
onScrollChange
101101
});
102102

103-
return <WrappedComponent {...passedProps} ref={ref} />;
103+
return <WrappedComponent {...restProps} ref={ref} />;
104104
}
105105

106106
ScrollingComponent.displayName = `Scrolling(${getDisplayName(WrappedComponent)})`;
@@ -110,7 +110,6 @@ export default function withScrolling(WrappedComponent) {
110110
horizontalStrength: PropTypes.func,
111111
strengthMultiplier: PropTypes.number
112112
};
113-
ScrollingComponent.defaultProps = defaultOptions;
114113

115114
return hoist(ScrollingComponent, WrappedComponent);
116115
}

0 commit comments

Comments
 (0)