Как мы можем сделать элемент div с прокруткой, чтобы вертикальная полоса прокрутки имела верхнюю позицию 100px?
import React, { useState, useEffect, createRef } from "react";
const DatePicker = () => {
const myRef = createRef();
const [openToDateNew, setOpenToDate] = useState(openToDate)
const handleScrollBottom = () => {
console.log("reached bottom")
setOpenToDate(new Date(openToDateNew + 365 * 864e5));
const node = myRef.current;
node.scrollTop = 100;
}
const handleScrollTop = () => {
console.log("reached Top")
setOpenToDate(new Date(openToDateNew - 365 * 864e5));
}
return (
<ReactScrollDetector
debounceTime={200}
accuracy={50}
onScrollBottom={handleScrollBottom}
onScrollTop={handleScrollTop}>
<div ref={myRef} style={{ minHeight: "300px", maxHeight: "300px", overflow: "auto" }}>
</div>
</ReactScrollDetector>
);
};