1 Answer, 1 is accepted
Hello,
That can be done by stoping the wheel event propagation using the component ref:
https://stackblitz.com/edit/react-3zbode-ax72nd?file=app/main.tsx
Regards,
Stefan
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
I am fairly new to React. We have created a component for the input. Can you see how to make this happen using this code?
Hello,
There are two main points:
1) Create e ref to the component:
https://reactjs.org/docs/refs-and-the-dom.html
2) When the component mounts, add the event listener:
https://reactjs.org/docs/react-component.html#componentdidmount
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
3) Remove the event listener when the component un-mounts:
https://reactjs.org/docs/react-component.html#componentwillunmount
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener
There are the steps when using a class component. Based on the code I see that you are using a class component.
I tried to add it this way:
import React from "react"
})(CDUBalanceInputasany)
But I get this error:
Hello,
The error occurs because of this line:
`const ref = React.useRef(null);`
I made a class version of the same example to showcase the approach:
https://stackblitz.com/edit/react-3zbode-px8k2o?file=app/main.tsx
SO I tried to move this over to your version an still running into several errors :(
These are all TypeScript errors. They can be resolved by setting `this.ref` as type `any`.