Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8907] Android: click event does not fire correctly when touchStart listener is present on view

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-05-25T17:38:28.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 2.1.0, Sprint 2012-11 Core
ComponentsAndroid
Labelscore, module_gesture, qe-testadded
ReporterOpie Cyrus
AssigneeMax Stepanov
Created2012-04-27T17:34:06.000+0000
Updated2012-07-12T12:03:38.000+0000

Description

Click event does not fire for view when a touchStart listener is present on view. Example code:
var baseHeight = 200;
var baseWidth = 200;
 
var win = Ti.UI.createWindow({
    backgroundColor: '#fff',
    fullscreen: false,
    exitOnClose: true
});
var view = Ti.UI.createView({
    height: baseHeight,
    width: baseWidth,
    backgroundColor: '#a00'
});
var label = Ti.UI.createLabel({
    text: baseWidth + ' x ' + baseHeight,
    color: '#fff',
    font: {
        fontSize: 24,
        fontWeight: 'bold'
    }
});
view.add(label);
win.add(view);
  
view.addEventListener('pinch', function(e) {
    view.height = baseHeight * e.scale;
    view.width = baseWidth * e.scale;
    label.text = Math.round(view.width) + ' x ' + Math.round(view.height);
});
view.addEventListener('touchstart', function(e) { 
    baseHeight = view.height;
    baseWidth = view.width;
});
view.addEventListener('click', function(e) { 
    Ti.API.info(">>>>>>>>>> inside click event");
});
 
win.open();
Commenting out the touchstart listener will allow the click events to get through.

Comments

  1. Max Stepanov 2012-05-22

    PR pending https://github.com/appcelerator/titanium_mobile/pull/2250
  2. Smitha Guduru 2012-06-23

    Click event fires correctly in sample code. Tested on Titanium Studio, build: 2.2.0.201206222035 Titanium SDK: 2.1.0.v20120622174154 Device:Xoom(4.0.3)
  3. Olga Romero 2012-06-23

    verified fix with Titanium Studio, build: 2.1.0.201206221045 Titanium SDK: 2.1.0.v20120622174154 Device: Nexus S 4.0.4

JSON Source