-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add prop for disabling the wheel handler #97
Conversation
I think a better solution is extending onVerticalScroll to stop propagation if it returns false. Thoughts? |
@@ -346,7 +351,7 @@ var FixedDataTable = React.createClass({ | |||
}, | |||
|
|||
_shouldHandleWheelX(/*number*/ delta) /*boolean*/ { | |||
if (this.props.overflowX === 'hidden') { | |||
if (this.props.overflowX === 'hidden' || this.props.disableWheelHandler) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to handle ReactWheelHandler being initalized here:
https://github.com/schrodinger/fixed-data-table-2/blob/master/src/FixedDataTable.js#L334
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? ReactWheelHandler takes both _shouldHandleWheel*
functions as parameters, and since it is initialised in componentWillMount
, changing disableWheelHandler
during the lifecycle of the component wouldn't change any behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh! why doesn't this wheelHandler use the same _shouldHandleWheel*
functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure (we inherited this code from the original repo)
I'm guessing one reason is that it doesn't have access to this.props yet.
@wcjordan This seems like a big memory leak, creating unnecessary wheel handlers if the table switches from overflow on and off.
It seems unnecessary to create it in that function, since the handler is already initialized in componentWillMount.
wouldn't changing |
No, overflowX/overflowY set to none disables the scrollbars. |
hmm I see. maybe that might be sensible since horizontal scrolling is already working that way. then we also wouldn't have to worry about changing wheelHandler functionality in this PR. |
LGTM, sorry for the delay; I was on vacation. |
Description
adds a new boolean propdisableWheelHandler
, that, when enabled, will disable handling wheel events.adds a new boolean prop
onVerticalScroll
, that works likeonHorizontalScroll
.Motivation and Context
we have a use-case in which we need to handle the wheel by ourselves since we are using window scrolling with the table. now we need to resort to a hack like this:
which is very ugly, so would be nice to be able to do this "officially" via a property!
Types of changes
Checklist: