[AC-4996] Setting touchEnabled=false when catching singletap event is preventing click event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-06-02T19:01:54.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Jason Kotchoff |
Assignee | Shak Hossain |
Created | 2017-05-26T00:19:28.000+0000 |
Updated | 2017-06-02T19:01:54.000+0000 |
Description
When setting touchEnabled=false (even temporarily) inside a singltap event handler, any click events also associated with the same view fail to fire.
ie. in the following code snippet, the click event used to fire in previous versions of titanium but it is now being suppressed
{{var win = Ti.UI.createWindow();
var view = Ti.UI.createView({width: 100, height: 100, backgroundColor: 'blue'});
view.addEventListener('singletap', function(){
console.log('singletap captured');
// Show a highlight effect on the view
view.originalBackgroundColor = view.backgroundColor;
view.backgroundColor = "yellow";
view.touchEnabled = false;
setTimeout(function() {
view.backgroundColor = view.originalBackgroundColor;
}, 70);
setTimeout(function() {
view.touchEnabled = true;
}, 500);
});
view.addEventListener('click', function(){
// In previous versions of Ti, this used to fire
console.log('click captured');
});
win.add(view);
win.open();
}}
Hello, This not a bug. If you set touchEnable, false to view it should not receive any touch event. See: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.View-property-touchEnabled