[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.
Comments
- Max Marttinen 2011-04-15
Forgot:
This affects the mobile sdk on ipad.
Testet with 1.2.x and 1.3.0. - Thomas Aylott 2011-04-15
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!webView.addEventListener('my-swipe', handleSwipe)
And then in the page…
window.location = "app-my-swipe://?_" + +new Date;
And it'll fire your 'my-swipe' event in your Titanium context.
- Thomas Aylott 2011-04-15
ug… broken formatting :/
- Stephen Tramer 2011-04-15
May not be able to support this, because if you intercept swipes on a webview, they stop working.
- Pedro Enrique 2011-04-15
This is happening, not only with the swipe event, but with any touch events. Example:
var win = Titanium.UI.createWindow(); var web = Titanium.UI.createWebView({url: 'some.pdf'}); var view = Ti.UI.createView({}); view.add(web); win.add(view); win.open({modal:true}); web.addEventListener('click', function(e){ alert('click'); }); /* view.addEventListener('click', function(e){ alert('click'); }); */ /* win.addEventListener('click', function(e){ alert('click'); }); */
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 - Blain Hamon 2011-07-27 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.
- Ramakrishna 2014-08-13
Hi,
I did a quick fix. Hope this sample solution will help to have both swipe and scroll web view content.
Index.xml:
- Lee Morris 2017-03-24 Closing ticket with reference to the previous comments.