Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4996] Setting touchEnabled=false when catching singletap event is preventing click event

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2017-06-02T19:01:54.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterJason Kotchoff
AssigneeShak Hossain
Created2017-05-26T00:19:28.000+0000
Updated2017-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(); }}

Comments

  1. Sharif AbuDarda 2017-05-29

    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

JSON Source