-
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
Adding touch support #7
Conversation
@@ -0,0 +1,112 @@ | |||
/** |
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.
For now lets move this directly into src rather than vendor_upstream since there's no upstream for it.
The code all lgtm, but I tested this out on my android phone and the scroll isn't very smooth / sticks a half second after I start dragging. Did you experience anything like this? I wonder if using a 3rd party library with a higher level API would help address that issue? Either way, I'm fine with merging this and working out the issues in an additional commit |
FastClick may fix the delay. |
if (!handleScrollX && !handleScrollY) { | ||
return; | ||
} | ||
|
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.
If handleScroll is false, we should set the delta value to zero, right?
this._deltaX = handleScrollX ? this._deltaX : 0;
this._deltaY = handleScrollY ? this._deltaY : 0;
Currently, if the table fits inside the width of the window, handleScrollX
comes back false, making _deltaX
always relative to the TouchStart point.
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.
Good catch, will add
onTouchEnd(/*object*/ event) { | ||
|
||
// Stop tracking velocity | ||
clearInterval(this._trackerId); |
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.
@wcjordan Don't we need to handle touch cancel to clear the interval?
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.
Good idea, will add.
@KamranAsif I'm going to merge this in and then do a separate commit for fixing onTouchCancel. |
Summary: Manually brings in these two PRs from github.com/schrodinger/fixed-data-table-2: - schrodinger/fixed-data-table-2#7 - schrodinger/fixed-data-table-2#19 Also - pins React to 15.1.0 Test Plan: Manual, tested in Chrome mobile emulator so far, will test on multiple devices to see if there's improvement Reviewers: jose, Hsin, yongxu Reviewed By: Hsin, yongxu Differential Revision: http://code.seamlessdocs.com/D969
Description
Adding new ReactTouchHandler (probably needs to be moved somewhere else)
Tracks start position on touchStart, and calculates delta similar to ReactScrollHandler
The callback is shared between the two
Motivation and Context
Issue filed: #5
How Has This Been Tested?
Tested locally with dev server. Added an example with touch enabled
Types of changes
Checklist: