![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
react-is-scrolling
Advanced tools
Simply detect if users are scrolling in your components in a declarative API
This package is providing you a Higher Order Component with a declarative API so you can detect if your users are scrolling in the browser or not. Apart from that you can also detect the direction of their scrolling like below.
npm i react-is-scrolling --save
import React, { Component } from 'react';
import IsScrolling from 'react-is-scrolling';
@IsScrolling
export default class YourComponent extends Component {
render() {
const { isScrolling, isScrollingDown, isScrollingUp } = this.props;
return (
<div>
{ isScrolling &&
<p>You are scrolling</p>
}
{ isScrollingDown &&
<p>You are scrolling down</p>
}
{ isScrollingUp &&
<p>You are scrolling up</p>
}
</div>
);
}
}
Notice that this package is not using an imperative event based system like other packages so it is much more aligned with React's declarative nature. Also it abstracts away all the heavy lifting of debouncing browser's scroll
event and is intended to support different browsers.
If you are not using ES7 decorator functions like @IsScrolling
or you want to have this package on a stateless/function component, you can simply use it this way:
import React, { Component } from 'react';
import IsScrolling from 'react-is-scrolling';
function YourComponent({isScrolling, isScrollingDown, isScrollingUp}) {
return (
<div>
{ isScrolling &&
<p>You are scrolling</p>
}
{ isScrollingDown &&
<p>You are scrolling down</p>
}
{ isScrollingUp &&
<p>You are scrolling up</p>
}
</div>
);
}
export default IsScrolling(YourComponent);
You can check out how it works here
FAQs
Simply detect if users are scrolling in your components in a declarative API
We found that react-is-scrolling demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.