Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-11664

Android: TabGroup: Tabgroup focus event fired twice on application launch and one of those with source as undefined

    Details

      Description

      Tabgroup focus event fired twice on launch of application with tabgroup.

      This is a regression and does not happen on 2.1.3 and 2.1.4

      Steps to Reproduce:
      1. Create an application with code below
      2. Launch the application and check console

      Actual Result:
      The tabgroup focus event is fired twice and one of those have source undefined. Following are the console logs:
      I/TiAPI(8612): -------------> win1 focus event fired! - win 1
      I/TiAPI(8612): -------------> tab1 focus event fired! - Tab 1
      I/TiAPI(8612): -------------> tabGroup focus event fired! - Tab 1
      I/TiAPI(8612): -------------> tabGroup focus event fired! - undefined

      Expected Result:
      The tabgroup focus event should be fired only once

      var tabGroup = Ti.UI.createTabGroup();
       
      var win1 = Ti.UI.createWindow({
      	name: "win 1"
      });
      var tab1 = Ti.UI.createTab({
      	name: "Tab 1",
      	title:'Tab 1',
      	window:win1
      });
       
      var win2 = Ti.UI.createWindow({
      	name: "win 2",
      	title:'Tab 2',
      	backgroundColor:'#fff'
      });
      var tab2 = Ti.UI.createTab({
      	name: "Tab 2",
      	title:'Tab 2',
      	window:win2
      });
       
      tabGroup.addTab(tab1);
      tabGroup.addTab(tab2);
       
      tabGroup.addEventListener('focus', function(e){
      	Ti.API.info('-------------> tabGroup focus event fired! - ' + e.source.name);
      });
      tab1.addEventListener('focus', function(e){
      	Ti.API.info('-------------> tab1 focus event fired! - ' + e.source.name);
      });
      tab2.addEventListener('focus', function(e){
      	Ti.API.info('-------------> tab2 focus event fired! - ' + e.source.name);
      });
      win1.addEventListener('focus', function(e){
      	Ti.API.info('-------------> win1 focus event fired! - ' + e.source.name);
      });
      win2.addEventListener('focus', function(e){
      	Ti.API.info('-------------> win2 focus event fired! - ' + e.source.name);
      });
       
      tab1.addEventListener('blur', function(e){
      	Ti.API.info('**************> tab1 blur event fired! - ' + e.source.name);
      });
      tab2.addEventListener('blur', function(e){
      	Ti.API.info('**************> tab2 blur event fired! - ' + e.source.name);
      });
      win1.addEventListener('blur', function(e){
      	Ti.API.info('**************> win1 blur event fired! - ' + e.source.name);
      });
      win2.addEventListener('blur', function(e){
      	Ti.API.info('**************> win2 blur event fired! - ' + e.source.name);
      });
       
      tabGroup.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pwang Ping Wang
                Reporter:
                ssekhri Satyam Sekhri
              • Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Git Source Code