Fix timestamps on android touch events to use milliseconds, to be consistent with iOS

Summary:
So `PanReponder.onPanResponderRelease/onPanResponderTerminate` receive a `gestureState` object containing a `onPanResponderTerminate.vx/vy` property. On Android and iOS, they appear to be orders of magnitude different, which appear to be due to the different scale of timestamps that are used when generating touch events.

This pull request fixes the timestamps to be milliseconds on both platforms (since I assume iOS is the more authoritative one, and is the one that `react-native-viewpager`'s vx thresholds written written to compare against.)

As far as I can tell, the RN code doesn't use the `vx/vy` properties, so they should be okay. And looks like the RN code only cares about relative values of `startTimestamp/currentTimestamp/previousTimestamp` though, so should be fine too. it's quite possible there will be downstream android breakage with this change, particularly for those who are already compensating for the RN discrepancy.
Closes https://github.com/facebook/react-native/pull/8199

Differential Revision: D3528215

Pulled By: dmmiller

fbshipit-source-id: cbd25bb7e7bb87fa77b661a057643a6ea97bc3f1
This commit is contained in:
Mike Lambert
2016-07-07 05:50:58 -07:00
committed by Facebook Github Bot 2
parent f5345601d9
commit 4f5c2b48fe
20 changed files with 57 additions and 53 deletions

View File

@@ -116,7 +116,7 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
eventDispatcher.dispatchEvent(
new ReactTextChangedEvent(
reactEditText.getId(),
SystemClock.nanoTime(),
SystemClock.elapsedRealtime(),
newText.toString(),
(int) PixelUtil.toDIPFromPixel(contentWidth),
(int) PixelUtil.toDIPFromPixel(contentHeight),
@@ -125,7 +125,7 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
eventDispatcher.dispatchEvent(
new ReactTextInputEvent(
reactEditText.getId(),
SystemClock.nanoTime(),
SystemClock.elapsedRealtime(),
newText.toString(),
"",
start,
@@ -150,7 +150,7 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
eventDispatcher.dispatchEvent(
new ReactTextChangedEvent(
reactEditText.getId(),
SystemClock.nanoTime(),
SystemClock.elapsedRealtime(),
newText.toString(),
(int) PixelUtil.toDIPFromPixel(contentWidth),
(int) PixelUtil.toDIPFromPixel(contentHeight),
@@ -159,7 +159,7 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
eventDispatcher.dispatchEvent(
new ReactTextInputEvent(
reactEditText.getId(),
SystemClock.nanoTime(),
SystemClock.elapsedRealtime(),
moreText,
"",
start,
@@ -184,7 +184,7 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
eventDispatcher.dispatchEvent(
new ReactTextChangedEvent(
reactEditText.getId(),
SystemClock.nanoTime(),
SystemClock.elapsedRealtime(),
newText.toString(),
(int) PixelUtil.toDIPFromPixel(contentWidth),
(int) PixelUtil.toDIPFromPixel(contentHeight),
@@ -193,7 +193,7 @@ public class TextInputTestCase extends ReactAppInstrumentationTestCase {
eventDispatcher.dispatchEvent(
new ReactTextInputEvent(
reactEditText.getId(),
SystemClock.nanoTime(),
SystemClock.elapsedRealtime(),
moreText,
"",
start,