Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-955] WebView + addEventListener('swipe', ...) disables scrolling

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2011-07-27T11:22:41.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-31
ComponentsiOS
Labelsn/a
ReporterMax Marttinen
AssigneeBlain Hamon
Created2011-04-15T02:40:07.000+0000
Updated2017-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

  1. Max Marttinen 2011-04-15

    Forgot:

    This affects the mobile sdk on ipad.
    Testet with 1.2.x and 1.3.0.

  2. 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.

  3. Thomas Aylott 2011-04-15

    ug… broken formatting :/

  4. Stephen Tramer 2011-04-15

    May not be able to support this, because if you intercept swipes on a webview, they stop working.

  5. 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

  6. 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.
  7. 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: Index.tss: ".container": { backgroundColor:"77d065" } "#scrollView":{ top:"20%", width:"100%", backgroundColor:"red" } Index.js: var webviewnews = []; for(var i = 0; i < 6; i++){ webviewnews[i] = Ti.UI.createWebView({ hideLoadIndicator : true, width: "100%", height: "100%" }); } webviewnews[0].url = "http://www.google.com"; webviewnews[1].url = "http://www.facebook.com"; webviewnews[2].url = "http://www.twitter.com"; webviewnews[3].url = "http://www.yahoo.com"; webviewnews[4].url = "http://www.flipkart.com"; webviewnews[5].url = "http://www.amazon.com"; $.scrollView.views = webviewnews; $.scrollView.setCurrentPage(2); $.scrollView.addEventListener('scrollend', function(e){ Ti.API.info('scrollend got called'); var position = $.scrollView.getCurrentPage(); //Write logic here to dynamic load of web view content }); $.index.open(); Hope this will help.
  8. Lee Morris 2017-03-24

    Closing ticket with reference to the previous comments.

JSON Source