Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3253] Expose Scrollmode for UIWebView.scrollView

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2014-09-01T06:12:06.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsTCSupportTriage
ReporterAndrew Greenstreet
AssigneeMauro Parra-Miranda
Created2014-08-05T15:48:26.000+0000
Updated2016-03-08T07:57:40.000+0000

Description

The default deceleration rate for the scrollview attached to a UiWebview is UIScrollViewDecelerationRateFast. This makes all webviews in TI, feel/appear/be perceived as running slower than other kinds of native views. I would suggest either: 1. Expose a scrollmode property for Ti.UI.WebView (there seems to be some logic behind this for very complex html that requires a lot of rendering) 2. Change the scrollmode such that around line 145 of TiUiWebView.m, add the following line.
webview.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
I enabled this in my SDK, and the results are astounding. Webviews become indistinguishable from other kinds of scrollviews.

Comments

  1. Mauro Parra-Miranda 2014-08-10

    Hello, do you have a reference website that clearly shows to be slow? So we can provide a testcase to the Platform team. Best Regards!
  2. Andrew Greenstreet 2014-08-10

    It's not a case of a specific website being slow, more specifically, this is a concern when using the WebView to generate app content (e.g. a list, a gallery, some other complex html) The default decelerationRate for the scrollView attached to UiWebView is "UIScrollViewDecelerationRateFast" while the default decelerationRate for a simple UiScrollView is "UIScrollViewDecelerationRateNormal". This means that, when creating a Ti.UI.WebView under iOS it will have a different deceleration speed than Ti.UI.ScrollView (or Ti.UI.TableView / ListView). Thus the webview will scroll to a stop very quickly (no matter how fast the user flicks the screen). This make WebViews, used for generating app content seem very different than other native views (e.g. list, scroll, table). My contention is that the deceleration rate of the webview should match that of other native views (as it is on Android and MobileWeb). If this was about opening Amazon.com (or any other website) in a Webview, I wouldn't have brought this up.
  3. Mauro Parra-Miranda 2014-09-01

    If customer provides a sample website that shows the slow scroll, will reopen.
  4. Andrew Greenstreet 2014-09-02

    Did you read my description from above at all? This isn't about a website, but about the difference between scroll deceleration rates of UiScroolViews.
  5. Steven van Loef 2014-10-07

    You might want to have a look at this module https://github.com/ryugoo/TiExtendWeb I think it does what you want.
  6. Andrew Greenstreet 2014-10-07

    Thanks for the tip. I'd rather not use a module, as my app is tri platform, soon to be quad platform. I'm just hacking the SDK for the time being, as I'm not sure Mauro understood what this request was about. If you read his comment, he is under the impression this is about some sort of slow scrolling of a website, when it is only about deceleration rates. From the module you linked, it becomes pretty clear
       - (void)setNormalScrollSpeed_:(id)args
       {
           BOOL normalSpeed = [TiUtils boolValue:args def:NO];
           UIScrollView *scrollView = [self performSelector:@selector(scrollview)];
           if (normalSpeed == YES) {
               [scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
           } else {
               [scrollView setDecelerationRate:UIScrollViewDecelerationRateFast];
           }
       }
       
    Every scrolling view in Titanium uses: UIScrollViewDecelerationRateNormal except Ti.UI.Webview, which uses UIScrollViewDecelerationRateFast Thus, when using the Webview to display local html-based views, along side native scrollviews, list views, table views, it seems clunky/broken as it slows at a much different rate than the other views.

JSON Source