[TIMOB-955] WebView + addEventListener('swipe', ...) disables scrolling
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2011-07-27T11:22:41.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint 2011-31 |
Components | iOS |
Labels | n/a |
Reporter | Max Marttinen |
Assignee | Blain Hamon |
Created | 2011-04-15T02:40:07.000+0000 |
Updated | 2017-03-24T19:06:21.000+0000 |
Description
Hi there.
When you add a EventListener for swipe either on a window (with a webview) or at a webview, it'll disable scrolling the webView.
Howto reproduce:
1) Create a new project
2) Add a webView to one of the windows (with enough content, so it
scrolls...)
3) Add the EventListener to the window or view
"foo.addEventListener('swipe', function (e) {} )"
Every function will do, even empty ones.
Forgot:
This affects the mobile sdk on ipad.
Testet with 1.2.x and 1.3.0.
Workaround:
You could use custom webview url handler events instead.
http://github.com/subtleGradient/titanium_mobile/tree/develop-webview-shouldStartLoadWithRequest-handler"> http://github.com/subtleGradient/titanium_mobile/tree/develop-webvi...
Detect the swipe in your page's JavaScript and then fire an event on the webView instance from the page.
Even works from external sites!
And then in the page…
And it'll fire your 'my-swipe' event in your Titanium context.
ug… broken formatting :/
May not be able to support this, because if you intercept swipes on a webview, they stop working.
This is happening, not only with the swipe event, but with any touch events. Example:
HD Ticket: http://developer.appcelerator.com/helpdesk/view/74881">http://developer.appcelerator.com/helpdesk/view/74881
Tested on iPhone Simulator 4.2
Ti SDK 1.6.0 RC1
Unfortunately, this is something we can't fix, as UIWebView, the underlying view, is quite a black box in iOS. Because of that, touch events have to be handled either exclusively by the titanium view holding the web view (IE, webview.addEventListener('swipe'...) ) or the native Webview (Ie, scrolling, buttons, etc.) As a workaround, if you must have any handling inside the webview, make gesture recognizers inside the HTML itself, and generate an app event to relay it outside.
Hi, I did a quick fix. Hope this sample solution will help to have both swipe and scroll web view content. Index.xml:
Closing ticket with reference to the previous comments.