Socket
Socket
Sign inDemoInstall

react-custom-scrollbars

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-custom-scrollbars - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

46

lib/Scrollbars.js

@@ -216,2 +216,48 @@ 'use strict';

scrollTop: function scrollTop() {
var top = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];
var $view = this.refs.view;
$view.scrollTop = top;
this.needsUpdate = true;
this.update();
},
scrollToTop: function scrollToTop() {
var $view = this.refs.view;
$view.scrollTop = 0;
this.needsUpdate = true;
this.update();
},
scrollToBottom: function scrollToBottom() {
var $view = this.refs.view;
$view.scrollTop = $view.scrollHeight;
this.needsUpdate = true;
this.update();
},
scrollLeft: function scrollLeft() {
var left = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0];
var $view = this.refs.view;
$view.scrollLeft = left;
this.needsUpdate = true;
this.update();
},
scrollToLeft: function scrollToLeft() {
var $view = this.refs.view;
$view.scrollLeft = 0;
this.needsUpdate = true;
this.update();
},
scrollToRight: function scrollToRight() {
var $view = this.refs.view;
$view.scrollLeft = $view.scrollWidth;
this.needsUpdate = true;
this.update();
},
update: function update() {

@@ -218,0 +264,0 @@ if (SCROLLBAR_WIDTH === 0) return;

10

package.json
{
"name": "react-custom-scrollbars",
"version": "1.0.2",
"version": "1.1.0",
"description": "React scrollbars component",

@@ -45,4 +45,4 @@ "main": "lib/index.js",

"mocha": "^2.2.5",
"react": "^0.14.0-rc1",
"react-dom": "^0.14.0-rc1",
"react": "^0.14.3",
"react-dom": "^0.14.3",
"rimraf": "^2.3.4",

@@ -53,6 +53,6 @@ "webpack": "^1.9.6",

"peerDependencies": {
"react": "^0.14.0-rc1",
"react-dom": "^0.14.0-rc1"
"react": "^0.14.3",
"react-dom": "^0.14.3"
},
"dependencies": {}
}

@@ -138,2 +138,35 @@ react-custom-scrollbars

#### Methods
* `scrollTop(top)`: Scroll to the top value
* `scrollLeft(left)`: Scroll to the left value
* `scrollToTop()`: Scroll to top
* `scrollToBottom()`: Scroll to bottom
* `scrollToLeft()`: Scroll to left
* `scrollToRight()`: Scroll to right
```javascript
import { Scrollbars } from 'react-custom-scrollbars';
class App extends Component {
handleClick() {
this.refs.scrollbars.scrollToTop()
},
render() {
return (
<div>
<Scrollbars
ref="scrollbars"
style={{ width: 500, height: 300 }}>
{/* your content */}
</Scrollbars>
<button onClick={this.handleClick.bind(this)}>
Scroll to top
</button>
</div>
);
}
}
```
### Receive values about the current position

@@ -140,0 +173,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc