[TIMOB-27500] Android DrawerLayout "open" event also fires "open" event of parent Window
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | Critical | 
| Status | Closed | 
| Resolution | Invalid | 
| Resolution Date | 2020-01-14T23:49:09.000+0000 | 
| Affected Version/s | n/a | 
| Fix Version/s | n/a | 
| Components | n/a | 
| Labels | android, drawerlayout, engTriage, event, open | 
| Reporter | Arjan | 
| Assignee | Gary Mathews | 
| Created | 2019-09-19T08:38:20.000+0000 | 
| Updated | 2020-01-15T07:50:46.000+0000 | 
Description
	When attaching the eventListener "open" to the drawer view, this also triggers the "open" eventListener of the parent window it has been added to.
EDIT: it also happens with the close event.
SDK: 8.1.1.GA
Code example:
var win = Ti.UI.createWindow();
var leftView = Ti.UI.createView({ backgroundColor:'red' });
var centerView = Ti.UI.createView({ backgroundColor:'yellow' });
var rightView = Ti.UI.createView({ backgroundColor:'orange' });
var drawer = Ti.UI.Android.createDrawerLayout({
    leftView: leftView,
    centerView: centerView,
    rightView: rightView
});
var btn = Ti.UI.createButton({ title: 'RIGHT' });
btn.addEventListener('click', function() {
    drawer.toggleRight();
});
centerView.add(btn);
win.addEventListener('open', function(){
	
	console.log('window opened');	
	
    var activity = win.getActivity(),
        actionBar = activity.getActionBar();
    if (actionBar) {
        actionBar.displayHomeAsUp = true;
        actionBar.onHomeIconItemSelected = function() {
            drawer.toggleLeft();
        };
    }
});
drawer.addEventListener('open', function() {
	console.log('drawer opened');	
});
drawer.addEventListener('close', function() {
	console.log('drawer closed');	
});
win.add(drawer);
win.open();
Hello [~arif], I was able to reproduce the issue in SDK 8.2.0.GA. I will forward this to the engineering team to investigate. Thanks.
Closing as invalid, this is not a bug.
bubbleParentis set totrueby default, you must set it tofalseto prevent events from bubbling up to parent views.Ti.UI.Android.createDrawerLayout({ bubbleParent: false, ...Nice one, can be that simple sometimes :-) Thanks for checking this!