Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18187] iOS: Ti.UI.Window Focus event is firing continuously.

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionWon't Fix
Resolution Date2014-12-11T17:24:05.000+0000
Affected Version/sRelease 3.5.0
Fix Version/sn/a
ComponentsiOS
Labelsqe-3.5.0, regression
ReporterKajenthiran Velummaylum
AssigneeVishal Duggal
Created2014-12-11T07:29:17.000+0000
Updated2017-03-21T18:15:25.000+0000

Description

This is a regression since 3.4.1 works fine.

Focus event is firing continuously (infinite times) for Ti.UI.Window.

Steps To Reproduce

1. Create a classic app using following code
Titanium.UI.setBackgroundColor('#000');

var win = Titanium.UI.createWindow({
	title: 'Window 1',
    backgroundColor: '#fff'
});

win.addEventListener('focus',function(e){
    alert('test win');
});

win.open();
2. Run the app in iOS device

Actual Result

Focus event is firing continuously ( infinite times)

Expected Result

Focus event should fire only once when it's focused.

Comments

  1. Ingo Muschenetz 2014-12-11

    [~bhatfield] expected behavior now, need to be in release notes.
  2. Vishal Duggal 2014-12-11

    This is now expected behavior. On iOS8 AlertDialogs and OptionDialogs are full fledged view controllers. So when they show up, the top most Window proxy will blur. It will regain focus when these dialogs are dismissed. So you have an infinite loop. Try this code to see discrepancy in behavior on iOS7 and iOS8.
       Titanium.UI.setBackgroundColor('#000');
        
       var win = Titanium.UI.createWindow({
           title: 'Window 1',
           backgroundColor: '#fff'
       });
       
       var opts = {
           cancel: 2,
           options: ['Confirm', 'Help', 'Cancel'],
           selectedIndex: 2,
           destructive: 0,
           title: 'Delete File?'
       };
       
       var optDialog = Ti.UI.createOptionDialog(opts);
       
       var aopts = {
           message: 'The file has been deleted',
           ok: 'Okay',
           title: 'File Deleted'
       }
       
       var aDialog = Ti.UI.createAlertDialog(aopts);
        
       win.addEventListener('focus',function(e){
           optDialog.show();
           //aDialog.show();
       });
        
       win.addEventListener('blur',function(e){
           Ti.API.info('WINDOW BLURRED');
       });
       win.open();
       
  3. Lee Morris 2017-03-21

    Closing ticket as the issue will not fix.

JSON Source