Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24273] iOS: Overwriting existing event listeners only calls the last one (Regression from 6.0.1)

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-01-05T18:35:33.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsiOS
Labelsios, regression
ReporterChristoph Eck
AssigneeChristopher Williams
Created2017-01-04T11:24:51.000+0000
Updated2017-01-05T23:24:24.000+0000

Description

*Problem* Overwrites the click event listeners if there is more than one defined. actual behavior

click in example on the label

in the log is shown 'click3'

expected behavior

click in example on the label

in the log is shown 'click1, click2 and click3'

*Test case*
var win = Ti.UI.createWindow({height: Ti.UI.SIZE, width: Ti.UI.SIZE, backgroundColor: "white"});
var label = Ti.UI.createLabel({text: "label"});
var view = Ti.UI.createView({height: Ti.UI.SIZE, width: Ti.UI.SIZE});

view.add(label);
win.add(view);
win.open();

view.addEventListener('click', function(event){
    Ti.API.info('click1');
});
view.addEventListener('click', function(event){
    Ti.API.info('click2');
});
view.addEventListener('click', function(event){
    Ti.API.info('click3');
});
*Log* actual behavior {noformat} [INFO] : click3 {noformat} expected behavior {noformat} [INFO] : click [INFO] : click2 [INFO] : click3 {noformat}

Comments

  1. Hans Knöchel 2017-01-04

    Ok, after some investigation, I found out that [this change](https://github.com/appcelerator/titanium_mobile/pull/8659) caused the regression in 6.1.0 master. It works properly in 6.0.1.GA.
  2. Christopher Williams 2017-01-05

    https://github.com/appcelerator/titanium_mobile/pull/8731
  3. Samir Mohammed 2017-01-05

    Verified fixed, When clicking on the label the log now shows:
       [INFO] :   click1
       [INFO] :   click2
       [INFO] :   click3
       
    *Environment*
       Appcelerator Command-Line Interface, version 6.1.0
       iphone 6 plus (ios 9.3.4)
       Operating System Name: Mac OS X El Capitan
       Operating System Version: 10.11.6
       Node.js Version: 4.6.0
       npm: 4.2.8
       Titanium SDK Version: 6.1.0.v20170105103604
       Xcode: 8.2
       Appcelerator Studio: 4.8.1.201612050850
       

JSON Source