
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
react-scroll-wheel-handler
Advanced tools
Simple react component for handling scroll trackpad, arrow keys, swipe gestures and mouse wheel event.
Simple react component for handling scroll trackpad, arrow keys, swipe gestures and mouse wheel event.
#Update
add prop disableSwipe.
removed customStyle from props.
Replace CustomContainerComponent with CustomComponent. It must have ref passed as a prop. Example:
const CustomComponent = forwardRef(({ children, ...props }, ref) => (
<div ref={ref} {...props} id="custom">
{children}
</div>
));
npm install --save react-scroll-wheel-handler
or
yarn add react-scroll-wheel-handler
import ReactScrollWheelHandler from "react-scroll-wheel-handler";
<ReactScrollWheelHandler
upHandler={(e) => console.log("scroll up")}
downHandler={(e) => console.log("scroll down")}
>
...
</ReactScrollWheelHandler>
#Props
All the other props are passed to the div/component returned.
import React, { Component } from "react";
import ReactScrollWheelHandler from " react-scroll-wheel-handler";
class App extends React.Component {
state = {
currentIndex: 0,
colors: ["red", "black", "grey", "blue", "green"],
};
nextIndex = () => {
const { colors, currentIndex } = this.state;
if (currentIndex == colors.length - 1) {
return this.setState({ currentIndex: 0 });
}
return this.setState({
currentIndex: currentIndex + 1,
});
};
prevIndex = () => {
const { colors, currentIndex } = this.state;
if (currentIndex == 0) {
return this.setState({
currentIndex: colors.length - 1,
});
}
return this.setState({
currentIndex: currentIndex - 1,
});
};
render() {
const { colors, currentIndex } = this.state;
return (
<div>
<ReactScrollWheelHandler
upHandler={this.prevIndex}
downHandler={this.nextIndex}
style={{
width: "100%",
height: "100vh",
backgroundColor: colors[currentIndex],
transition: "background-color .4s ease-out",
}}
>
<h1>SCROLL FOR CHANGE BACKGROUND COLOR</h1>
</ReactScrollWheelHandler>
</div>
);
}
}
FAQs
Simple react component for handling scroll trackpad, arrow keys, swipe gestures and mouse wheel event.
The npm package react-scroll-wheel-handler receives a total of 0 weekly downloads. As such, react-scroll-wheel-handler popularity was classified as not popular.
We found that react-scroll-wheel-handler 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
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.