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

iOS: Events - Focus event is fired multiple times during initial launch of app

    Details

      Description

      Steps to reproduce:
      1. Run following code:

      app.js

      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();
      

      Actual: After initial launch of code, focus event is fired 3 times for tabGroup and 2 times for tab:

      Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tabGroup focus event fired! - undefined
      Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tabGroup focus event fired! - undefined
      Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tab1 focus event fired! - Tab 1
      Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tabGroup focus event fired! - undefined
      Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tab1 focus event fired! - Tab 1
      Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> win1 focus event fired! - win 1
      

      Expected: Focus event should be fired once similarly when running code on Android:

      I/TiAPI   ( 1770): -------------> tab1 focus event fired! - Tab 1
      I/TiAPI   ( 1770): -------------> tabGroup focus event fired! - Tab 1
      I/TiAPI   ( 1770): -------------> win1 focus event fired! - win 1
      

      Note: Bug still occurs in 1.8.1

        Attachments

          Activity

            People

            • Assignee:
              stephentramer Stephen Tramer
              Reporter:
              wluu Wilson Luu (Inactive)
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-12243
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration