Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10319] iOS: dblclick event prevent quick click events

GitHub Issuen/a
TypeBug
PriorityMedium
StatusReopened
ResolutionUnresolved
Affected Version/sRelease 3.0.0, Release 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterMartin Guillon
AssigneePedro Enrique
Created2012-08-01T08:57:06.000+0000
Updated2015-09-11T02:59:18.000+0000

Description

In my application i often had the impression that some of my button clicks were not processed. I finally took the time to investigate the problem. It come from the fact that if tap count is 2 then no "click" event is ever fired. Or sometimes when pressing a button, you get 2 touch down events then a touch up event (final, not one of too). So in that case you just wont get a click event. I think the solution to that would be to use gesture for tap events (like for views ) instead of looking at the touch phase. I Think i will go for that implementation, but it still time to propose another implementation :)

Comments

  1. Nikhil Sharma 2012-08-02

    Hi, Did you test it on the device or simulator? Its working fine for me on the device.
  2. Martin Guillon 2012-08-03

    Yes i did, and i also get it on device. Also i must add that there is a deep problem with the implementation. If you use a button for gaming for exemple when you have to continuously press the button. Then with the implementation you will never get all the click events (which correspond to a tap count superior to 2).
  3. Neeraj Gupta 2012-08-06

    We need a complete test case with the JIRA tickets.
  4. Martin Guillon 2012-08-07

    very simple testcase
       
       var win = Ti.UI.createWindow({ fullscreen: true, backgroundColor: 'white'});
          
       var nbClicks = 0;
       var nbtouchend = 0;
       var nbsingletap = 0;
       //label using localization-ready strings from <app dir>/i18n/en/strings.xml
       var label = Ti.UI.createLabel({
           top:0
       });
       win.add(label);
       
       var label1 = Ti.UI.createLabel({
           top:40
       });
       win.add(label1);
       
       var label2 = Ti.UI.createLabel({
           top:80
       });
       win.add(label2);
         
       var button = Titanium.UI.createButton({
           title:'touch me!',
           width:200,
           height:40,
           bottom:20,
           left: 10
       });
         
       button.addEventListener('click', function()
       {
           nbClicks += 1;
           label.text = nbClicks + ' clicks';
       });
       
       button.addEventListener('touchend', function()
       {
           nbtouchend += 1;
           label1.text = nbtouchend + ' touchend';
       });
       
       button.addEventListener('singletap', function()
       {
           nbsingletap += 1;
           label2.text = nbsingletap + ' singletap';
       });
       win.add(button);
         
       win.open();
       
  5. Daniel Sefton 2012-09-25

    Martin, is there any reason you can't just use the singletap event? The click event is not intended to be fired on double tap, only when you firmly click a button.
  6. Martin Guillon 2012-09-26

  7. Hilko Lantinga 2012-09-27

    I'm having the exact same issue. Singletap is a workaround for me as I don't support Android any way. Still it's a bug I'd like to see resolved.
  8. Daniel Sefton 2012-09-27

  9. Martin Guillon 2012-09-28

  10. Daniel Sefton 2012-09-28

    I understand what you're saying now, I've re-opened the issue. My apologies for the inconvenience.
  11. Martin Guillon 2012-10-16

    pull request https://github.com/appcelerator/titanium_mobile/pull/3249
  12. jithinpv 2013-05-07

    issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 iOS iPhone Simulator: iOS SDK version: 6.0

JSON Source