react-native/Libraries
Dave Miller a3146e41a2 Add pagingEnabled to HorizontalScrollView
Summary:
This adds support for pagingEnabled to the HorizontalScrollView.

This is an initial implementation.

Because Android doesn't provide great details about what is happening with a scroll view after you are done touching it, we have some post touch handling.  This is kicked off either by touch up or a fling call.
Once we are doing that handling, we start a runnable that basically checks if we are still scrolling.  If we are, we just schedule that runnable again and check a frame later.  If we are done scrolling (no onScrollChanged since we last fired), we could be in one of two states, the fling is done or we are done snapping to the page boundary.  If we are in the fling done case, we then check if we need to scroll to a page boundary.  If so, we call smoothScrollTo and schedule ourself to check onScroll events again until done with that scroll.  If we are done with both (either we only did momentum scroll or we did that and then snapped to page), we can then fire the final event and stop checking.  This logic is all in handlePostTouchScrolling.

Because of the decision to only do page scrolling after momentum ends, we do allow you to scroll through with momentum a number of pages and the transition can be a little strange where it stops a sec and then slides to be page aligned.  As a follow up, we can probably smooth that up by changing the value we pass to super.fling() that would adjust it to be let momentum carry it to the page boundary.

Reviewed By: weicool

Differential Revision: D3207608

fb-gh-sync-id: 02f62970ed9a5e3a5f9c0d959402756bc4b3699e
fbshipit-source-id: 02f62970ed9a5e3a5f9c0d959402756bc4b3699e
2016-05-05 04:14:22 -07:00
..
ART Check if either array is null before diffing 2016-04-25 13:28:31 -07:00
ActionSheetIOS CHORE - Remove Trailing Spaces 2016-04-06 09:21:53 -07:00
AdSupport Text highlighting on iOS 2015-07-24 08:41:58 -08:00
Animated Fix setValue to work properly on natively driven nodes 2016-05-04 02:48:22 -07:00
AppRegistry Fix some warnings. 2016-04-20 20:45:22 -07:00
AppState Remove knowledge of fbjs from the packager 2016-03-02 04:28:38 -08:00
AppStateIOS Updating AppState to support the inactive state. 2016-03-10 08:30:24 -08:00
BatchedBridge Cleanup InitializeJavascriptAppEngine 2016-05-04 10:50:32 -07:00
BugReporting refactor BugReporting to use RCTDeviceEventEmitter 2016-04-22 11:24:40 -07:00
CameraRoll Corrected bug that put the UTI instead of mimeType in retrieved assets 2016-05-03 08:53:34 -07:00
Components Add pagingEnabled to HorizontalScrollView 2016-05-05 04:14:22 -07:00
CustomComponents clarify highlightRow usage with UIExplorer example 2016-05-05 03:43:47 -07:00
DebugComponentHierarchy Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
Device Decouple Module System from Native Calls 2015-12-08 16:03:37 -08:00
Devtools Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
Experimental SwipeableRow fix 2016-05-04 19:51:18 -07:00
Fetch Reject promise if network request failed 2016-03-08 16:37:24 -08:00
Geolocation Fix distanceFilter caching for LocationObserver 2016-05-04 10:35:30 -07:00
Image Update Jest APIs on fbsource 2016-04-27 19:16:32 -07:00
Inspector Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
Interaction Fix JSWatchdog reset 2016-05-03 19:20:26 -07:00
JavaScriptAppEngine Cleanup InitializeJavascriptAppEngine 2016-05-04 10:50:32 -07:00
LayoutAnimation Add support for delete animation in LayoutAnimation on iOS 2016-04-25 00:19:25 -07:00
Linking Mention native code in `Linking` docs 2016-04-20 19:23:19 -07:00
LinkingIOS Added explicit init to observer modules 2016-05-04 07:07:24 -07:00
Modal Modal Animation Types 2016-04-28 16:00:32 -07:00
NativeApp Decouple Module System from Native Calls 2015-12-08 16:03:37 -08:00
NavigationExperimental Update Jest APIs on fbsource 2016-04-27 19:16:32 -07:00
Network Remove all null values for request headers 2016-05-03 23:42:26 -07:00
PullToRefresh Fix red screen due to ref being undefined in PullRefreshViewAndroid 2016-04-19 06:58:22 -07:00
PushNotificationIOS Added explicit init to observer modules 2016-05-04 07:07:24 -07:00
QuickPerformanceLogger added QPL for main interactions 2015-09-29 22:25:23 -07:00
RCTTest CHORE - Remove Trailing Spaces 2016-04-06 09:21:53 -07:00
RKBackendNode Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
ReactIOS Fix or suppress errors in react-native 2016-04-21 19:47:24 -07:00
ReactNative Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
Sample Remove knowledge of fbjs from the packager 2016-03-02 04:28:38 -08:00
Settings Remove knowledge of fbjs from the packager 2016-03-02 04:28:38 -08:00
Storage Update AsyncStorage.js 2016-04-10 18:02:20 -07:00
StyleSheet Deprecate transformMatrix and decomposedMatrix 2016-04-29 14:19:25 -07:00
Text Removed placeholder image logic 2016-04-25 03:31:19 -07:00
Utilities Let JS modules use strings instead of ids on Android 2016-05-04 10:29:26 -07:00
Vibration Add support for vibration patterns 2016-03-29 21:45:20 -07:00
WebSocket Update Jest APIs on fbsource 2016-04-27 19:16:32 -07:00
react-native Fix react-native.js.flow 2016-04-22 18:02:28 -07:00
vendor Remove ImmediateImplementation, always use globals 2016-04-28 07:06:20 -07:00
Promise.js Remove knowledge of fbjs from the packager 2016-03-02 04:28:38 -08:00
promiseRejectionIsError.js Add possibility to `console.error`/redbox on promise rejections 2016-03-15 05:22:22 -07:00