Skip to content

Commit 5c6ddd8

Browse files
committed
Remove scrollbar dependency
1 parent a884327 commit 5c6ddd8

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"netlify-auth-providers": "^1.0.0-alpha5",
1010
"prismjs": "^1.15.0",
1111
"react": "^16.8.1",
12-
"react-custom-scrollbars": "^4.2.1",
1312
"react-dom": "^16.8.1",
1413
"react-scripts": "2.1.3",
1514
"react-swipeable": "^4.3.2",

src/scroller.css

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.scroller::-webkit-scrollbar {
2+
background-color: rgba(255, 255, 255, 0.01);
3+
}
4+
5+
.scroller::-webkit-scrollbar-thumb {
6+
background-color: rgb(173, 219, 103, 0.3);
7+
}

src/scroller.js

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from "react";
2-
32
import useChildren from "./use-virtual-children";
4-
import { Scrollbars } from "react-custom-scrollbars";
3+
import "./scroller.css";
54

65
export default function Scroller({
76
items,
@@ -24,21 +23,15 @@ export default function Scroller({
2423
});
2524

2625
React.useLayoutEffect(() => {
27-
ref.current.scrollTop(top);
26+
ref.current.scrollTop = top;
2827
}, [top]);
2928

3029
return (
31-
<Scrollbars
32-
autoHide
30+
<div
31+
style={{ height: "100%", overflowY: "auto" }}
32+
class="scroller"
3333
ref={ref}
34-
// onScrollFrame={({ scrollTop }) => setTop(scrollTop)}
3534
onScroll={e => setTop(e.target.scrollTop)}
36-
renderThumbVertical={({ style, ...props }) => (
37-
<div
38-
style={{ ...style, backgroundColor: "rgb(173, 219, 103, 0.3)" }}
39-
{...props}
40-
/>
41-
)}
4235
children={children}
4336
/>
4437
);
@@ -48,7 +41,7 @@ function useHeight(ref) {
4841
let [height, setHeight] = React.useState(null);
4942

5043
function handleResize() {
51-
setHeight(ref.current.getClientHeight());
44+
setHeight(ref.current.clientHeight);
5245
}
5346

5447
React.useEffect(() => {

0 commit comments

Comments
 (0)