|
@@ -9,6 +9,8 @@ interface Props {
|
|
|
autoHideDuration?: number;
|
|
autoHideDuration?: number;
|
|
|
autoMaxHeight?: string;
|
|
autoMaxHeight?: string;
|
|
|
hideTracksWhenNotNeeded?: boolean;
|
|
hideTracksWhenNotNeeded?: boolean;
|
|
|
|
|
+ renderTrackHorizontal?: React.FunctionComponent<any>;
|
|
|
|
|
+ renderTrackVertical?: React.FunctionComponent<any>;
|
|
|
scrollTop?: number;
|
|
scrollTop?: number;
|
|
|
setScrollTop: (value: React.MouseEvent<HTMLElement>) => void;
|
|
setScrollTop: (value: React.MouseEvent<HTMLElement>) => void;
|
|
|
autoHeightMin?: number | string;
|
|
autoHeightMin?: number | string;
|
|
@@ -26,7 +28,7 @@ export class CustomScrollbar extends PureComponent<Props> {
|
|
|
autoMaxHeight: '100%',
|
|
autoMaxHeight: '100%',
|
|
|
hideTracksWhenNotNeeded: false,
|
|
hideTracksWhenNotNeeded: false,
|
|
|
setScrollTop: () => {},
|
|
setScrollTop: () => {},
|
|
|
- autoHeightMin: '0'
|
|
|
|
|
|
|
+ autoHeightMin: '0',
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
private ref: React.RefObject<Scrollbars>;
|
|
private ref: React.RefObject<Scrollbars>;
|
|
@@ -45,7 +47,7 @@ export class CustomScrollbar extends PureComponent<Props> {
|
|
|
} else {
|
|
} else {
|
|
|
ref.scrollTop(this.props.scrollTop);
|
|
ref.scrollTop(this.props.scrollTop);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
@@ -57,7 +59,7 @@ export class CustomScrollbar extends PureComponent<Props> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
- const { customClassName, children, autoMaxHeight } = this.props;
|
|
|
|
|
|
|
+ const { customClassName, children, autoMaxHeight, renderTrackHorizontal, renderTrackVertical } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<Scrollbars
|
|
<Scrollbars
|
|
@@ -67,8 +69,8 @@ export class CustomScrollbar extends PureComponent<Props> {
|
|
|
// These autoHeightMin & autoHeightMax options affect firefox and chrome differently.
|
|
// These autoHeightMin & autoHeightMax options affect firefox and chrome differently.
|
|
|
// Before these where set to inhert but that caused problems with cut of legends in firefox
|
|
// Before these where set to inhert but that caused problems with cut of legends in firefox
|
|
|
autoHeightMax={autoMaxHeight}
|
|
autoHeightMax={autoMaxHeight}
|
|
|
- renderTrackHorizontal={props => <div {...props} className="track-horizontal" />}
|
|
|
|
|
- renderTrackVertical={props => <div {...props} className="track-vertical" />}
|
|
|
|
|
|
|
+ renderTrackHorizontal={renderTrackHorizontal || (props => <div {...props} className="track-horizontal" />)}
|
|
|
|
|
+ renderTrackVertical={renderTrackVertical || (props => <div {...props} className="track-vertical" />)}
|
|
|
renderThumbHorizontal={props => <div {...props} className="thumb-horizontal" />}
|
|
renderThumbHorizontal={props => <div {...props} className="thumb-horizontal" />}
|
|
|
renderThumbVertical={props => <div {...props} className="thumb-vertical" />}
|
|
renderThumbVertical={props => <div {...props} className="thumb-vertical" />}
|
|
|
renderView={props => <div {...props} className="view" />}
|
|
renderView={props => <div {...props} className="view" />}
|