Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-824] Parent events fired when child view has same event callback

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:54:21.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterStephen Tramer
AssigneeBlain Hamon
Created2011-04-15T02:37:15.000+0000
Updated2011-04-17T01:54:21.000+0000

Description

Sample code:

var w = Ti.UI.createWindow();

var v1 = Ti.UI.createView({
    top:10,
    left:10,
    right:10,
    bottom:10,
    backgroundColor:'#ff0000'
});

v1.addEventListener('touchstart', function() {
    Ti.API.info('Touched view 1');
});

var v2 = Ti.UI.createView({
    top:50,
    left:50,
    right:50,
    bottom:50,
    backgroundColor:'#00ff00'
});

v2.addEventListener('touchstart', function() {
    Ti.API.info('Touched view 2');
});

v1.add(v2);
w.add(v1);

w.open();

Click in the second view and you'll see both the events for v1 and v2 are fired. This may cause problems in some situations; maybe add a 'propagatesEvents' flag?

Comments

  1. Jeff Haynie 2011-04-15

    (from [466f3e41d7e648145f5166c451b5820db51fef04]) Closes #824: Events are no longer propagated beyond the first view which has a listener for them. http://github.com/appcelerator/titanium_mobile/commit/466f3e41d7e648145f5166c451b5820db51fef04"> http://github.com/appcelerator/titanium_mobile/commit/466f3e41d7e64...

JSON Source