DocSpace-buildtools/packages/asc-web-components/scrollbar/custom-scrollbars-virtual-list.js

49 lines
1.0 KiB
JavaScript
Raw Normal View History

/* eslint-disable react/prop-types */
2019-08-26 08:51:36 +00:00
import React from "react";
import Scrollbar from "../scrollbar";
2019-08-26 08:51:36 +00:00
class CustomScrollbars extends React.Component {
refSetter = (scrollbarsRef, forwardedRef) => {
if (scrollbarsRef) {
forwardedRef(scrollbarsRef.view);
} else {
forwardedRef(null);
}
};
render() {
const {
onScroll,
forwardedRef,
style,
children,
className,
stype,
2019-08-26 08:51:36 +00:00
} = this.props;
//console.log("CustomScrollbars", this.props);
return (
<Scrollbar
ref={(scrollbarsRef) =>
2019-08-26 08:51:36 +00:00
this.refSetter.bind(this, scrollbarsRef, forwardedRef)
}
style={{ ...style, overflow: "hidden" }}
onScroll={onScroll}
2019-08-26 08:51:36 +00:00
stype={stype}
className={className}
>
{children}
</Scrollbar>
);
2019-08-26 08:51:36 +00:00
}
}
CustomScrollbars.defaultProps = {
stype: "smallBlack",
2019-08-26 08:51:36 +00:00
};
const CustomScrollbarsVirtualList = React.forwardRef((props, ref) => (
<CustomScrollbars {...props} forwardedRef={ref} />
));
2019-08-26 08:51:36 +00:00
export default CustomScrollbarsVirtualList;