Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15898] iOS: TabGroup focus event is not fired on first focus

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2013-12-05T21:43:41.000+0000
Affected Version/sRelease 3.1.3
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterShameer Jan
AssigneeIngo Muschenetz
Created2013-12-05T10:43:48.000+0000
Updated2017-03-20T20:36:25.000+0000

Description

Problem Description

Steps to reproduce 1.Run following code Expected result: focus event should be fired on first focus. Actual result: No focus event fired on tab 1

Test case

var win1 = Ti.UI.createWindow({
    title: 'Win 1'
});
    
var tab1 = Ti.UI.createTab({  
    title: 'Tab 1',
    window: win1
});
    
var win2 = Ti.UI.createWindow({
    title: 'Win 2'
});
    
var tab2 = Ti.UI.createTab({  
    title: 'Tab 2',
    window: win2
});
   
var tabGroup = Ti.UI.createTabGroup({
       
});
            
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.open();
tabGroup.addEventListener('focus', function(e) {
    Ti.API.info('--------------------Focus tab index: ' + e.index);
});

But if we press tab2 and then tab1 this works fine as expected.

Comments

  1. Vishal Duggal 2013-12-05

    Add focus and open listeners before calling open
  2. Sabil Rahim 2013-12-05

    always add focus event before calling open Invalid.
       var win1 = Ti.UI.createWindow({
           title: 'Win 1'
       });
            
       var tab1 = Ti.UI.createTab({  
           title: 'Tab 1',
           window: win1
       });
            
       var win2 = Ti.UI.createWindow({
           title: 'Win 2'
       });
            
       var tab2 = Ti.UI.createTab({  
           title: 'Tab 2',
           window: win2
       });
           
       var tabGroup = Ti.UI.createTabGroup({
               
       });
                    
       tabGroup.addTab(tab1);
       tabGroup.addTab(tab2);
       
       tabGroup.addEventListener('focus', function(e) {
           Ti.API.info('--------------------Focus tab index: ' + e.index);
       });
       tabGroup.open();
       
  3. Shameer Jan 2013-12-06

    Same testcase works as expected on android, that is made me confused. Thank you.
  4. Lee Morris 2017-03-20

    Closing ticket as invalid.

JSON Source