From 0f7477f9f9fc13e437e311a188253366529bdeb2 Mon Sep 17 00:00:00 2001 From: August Flanagan Date: Thu, 28 Jan 2016 05:35:14 -0800 Subject: [PATCH] add flag to enable momentum scrolling on iOS Summary: Expose a `decelerationNormalEnabled` flag on WebView, which, when enabled, will WebView's ScrollView's `decelerationRate` to `UIScrollViewDecelerationRateNormal`. This gives the WebView the same "momentum" style scrolling as other iOS views. This was discussed with ide in #5447. Please let me know if there's anything I'm missing, or anything else you'd like to see in this pull request. Closes https://github.com/facebook/react-native/pull/5527 Reviewed By: svcscm Differential Revision: D2870312 Pulled By: nicklockwood fb-gh-sync-id: 7dbfd06a349e3365a5df40c3bacf25a4fdb306cf --- Examples/UIExplorer/ImageEditingExample.js | 9 +----- Examples/UIExplorer/WebViewExample.js | 1 + Libraries/Components/ScrollView/ScrollView.js | 17 +++++++++-- .../ScrollView/processDecelerationRate.js | 29 +++++++++++++++++++ Libraries/Components/WebView/WebView.ios.js | 16 ++++++++++ React/Views/RCTWebViewManager.m | 1 + 6 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 Libraries/Components/ScrollView/processDecelerationRate.js diff --git a/Examples/UIExplorer/ImageEditingExample.js b/Examples/UIExplorer/ImageEditingExample.js index 8f4e4e7f6..86b4f5343 100644 --- a/Examples/UIExplorer/ImageEditingExample.js +++ b/Examples/UIExplorer/ImageEditingExample.js @@ -30,8 +30,6 @@ var { View, } = React; -var RCTScrollViewConsts = UIManager.RCTScrollView.Constants; - var PAGE_SIZE = 20; type ImageOffset = { @@ -249,17 +247,12 @@ class ImageCropper extends React.Component { } render() { - var decelerationRate = - RCTScrollViewConsts && RCTScrollViewConsts.DecelerationRate ? - RCTScrollViewConsts.DecelerationRate.Fast : - 0; - return (