This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Add onScrollStart callback#147
Merged
wlis merged 2 commits intofacebookarchive:masterfrom Jun 22, 2015
Merged
Conversation
src/FixedDataTable.react.js
Outdated
Contributor
There was a problem hiding this comment.
I think the functionality is very reasonable, but I would like us to avoid having information "isScrolling" in state of component, because we don't inform render by it in any way, so it may mark the table as needing re-render unnecessarily. Could you please move this to private var?
Contributor
Author
|
@wlis good point, updated. |
Contributor
|
Thanks for the pull request! |
sepo-one
pushed a commit
to One-com/fixed-data-table
that referenced
this pull request
Sep 3, 2017
* 15.5 support * Adding several fixes * Removing isMounted calls * Fixing merge conflict * Adding missing package * Move prop-types & create-react-class to dependencies Also update react-docgen version & ExampleImage to not use isMounted
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
onScrollStartcallback to be paired with FixedDataTable's existingonScrollEnd.Problem
In order to add a hover state to a row we need to redraw when the mouse enters and leaves each row. This can be done using css hover or using the Table's
onRowMouseEnterandonRowMouseLeave. The problem with both of these options is that when mouse wheel scrolling no native mouse leave event seems to fire from the browser (seen at least in FF, Chrome, Safari). This means as the row scrolls off it remains in hovered state even though the mouse is no longer over it. I believe this is a translate/translate3d bug or optimisation.Only when you move the mouse again does hover state update. This also means that when you stop wheel scrolling the row under the mouse does not draw its hovered state until you move the mouse.
As mentioned in #17 css hover is preferred for performance reasons, but even if that did work properly you'd still be sacrificing some performance due to constant redraws during scrolling.
Solution
When
onScrollStartfires remove current hover state and disable hover updates untilonScrollEnd.As a side note, in order to reapply the hover state when wheel scrolling stops I track the mouse position while the table is mounted and when
onScrollEndfires I do some basic hit detection based on the scroll position to determine which row is under the mouse.Maybe there's a simpler solution for all this? For now this was the only way I could find to get bug free + performant hover states.