[AC-3253] Expose Scrollmode for UIWebView.scrollView
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | n/a |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2014-09-01T06:12:06.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | TCSupportTriage |
Reporter | Andrew Greenstreet |
Assignee | Mauro Parra-Miranda |
Created | 2014-08-05T15:48:26.000+0000 |
Updated | 2016-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.
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!
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.
If customer provides a sample website that shows the slow scroll, will reopen.
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.
You might want to have a look at this module https://github.com/ryugoo/TiExtendWeb I think it does what you want.
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
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.