[TIMOB-10319] iOS: dblclick event prevent quick click events
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Reopened |
| Resolution | Unresolved |
| Affected Version/s | Release 3.0.0, Release 3.1.0 |
| Fix Version/s | n/a |
| Components | iOS |
| Labels | n/a |
| Reporter | Martin Guillon |
| Assignee | Pedro Enrique |
| Created | 2012-08-01T08:57:06.000+0000 |
| Updated | 2015-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 :)
Hi, Did you test it on the device or simulator? Its working fine for me on the device.
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).
We need a complete test case with the JIRA tickets.
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();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.
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.
I understand what you're saying now, I've re-opened the issue. My apologies for the inconvenience.
pull request https://github.com/appcelerator/titanium_mobile/pull/3249
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