Skip to content

Commit

Permalink
upgrade to 0.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Hao Liu committed Apr 12, 2019
1 parent 38334c0 commit d6a4714
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
## [0.3.4] - 2019-04-12

- Fixed window resizing messing up scroll bar.

## [0.3.3] - 2019-04-09

### Fixed
Fixed
- Hanlder automatically hide too early when clicking happens

### Added
Added
- TypeScript typings
- `start` Prop now accept specific numbers
- Add `setPosition` method to update the scrolling position manually
1 change: 1 addition & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default class FreeScrollbar extends React.PureComponent<Props, State> {
componentDidUpdate(): void;
private handleReadyStateChange;
private prepareScrollbar;
private prepareScrollbarStartPos;
private collectInfo;
private updateTrackVisibilities;
private resetHandlerHider;
Expand Down
5 changes: 5 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-free-scrollbar",
"version": "0.3.3",
"version": "0.3.4",
"description": "A react module for creating customizable scroll area",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
7 changes: 6 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export default class FreeScrollbar extends React.PureComponent<Props, State> {
: this.props.onScrollbarScroll;

public componentDidMount() {
window.addEventListener('resize', this.prepareScrollbar);
document.addEventListener('mousemove', this.handleHandlerMouseMove);
document.addEventListener('mouseup', this.handleHandlerMouseUp);
document.addEventListener('readystatechange', this.handleReadyStateChange);
Expand All @@ -183,6 +184,7 @@ export default class FreeScrollbar extends React.PureComponent<Props, State> {
}

public componentWillUnmount() {
window.removeEventListener('resize', this.prepareScrollbar);
document.removeEventListener('mousemove', this.handleHandlerMouseMove);
document.removeEventListener('mouseup', this.handleHandlerMouseUp);
document.removeEventListener('readystatechange', this.handleReadyStateChange);
Expand All @@ -197,6 +199,7 @@ export default class FreeScrollbar extends React.PureComponent<Props, State> {
private handleReadyStateChange = () => {
if (document.readyState === 'complete') {
this.prepareScrollbar();
this.prepareScrollbarStartPos();
}
};

Expand All @@ -206,7 +209,9 @@ export default class FreeScrollbar extends React.PureComponent<Props, State> {

// Trigger auto hider.
this.handlerContainerScroll();
};

private prepareScrollbarStartPos = () => {
const { start } = this.props;
if (typeof start === 'string') {
if (start.includes('bottom')) {
Expand All @@ -219,7 +224,7 @@ export default class FreeScrollbar extends React.PureComponent<Props, State> {
this.el.scrollTop = start.top;
this.el.scrollLeft = start.left;
}
};
}

private collectInfo = () => {
this.offsetWidth = this.el.offsetWidth;
Expand Down

0 comments on commit d6a4714

Please sign in to comment.