
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
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 1,297 weekly downloads. As such, react-scroll-wheel-handler popularity was classified as 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.