![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-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.
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
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.