[AC-1225] If alert("hello") or AlertDialog show function is written on window focus event then window focus event is called infinite times.
GitHub Issue | n/a |
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2015-08-10T18:43:05.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | alert, alertdialog, event, focus, infinite, ios, issue, listener, times |
Reporter | MoizChhatriwala |
Assignee | Radamantis Torres-Lechuga |
Created | 2015-05-11T05:29:27.000+0000 |
Updated | 2016-03-08T07:37:36.000+0000 |
Description
When the alert function is called on window focus event the that alert function gets called infinite times, this is because window focus events gets on calling infinite times.
Another problem is window focus event should not call on calling alert or alertDialog.show()
Test the code on iOS simulator or device to reproduce bug.
Below is the code to test the bug, window focus event should not get called infinite times when alert code is written on window focus event.
Case 1:
var win1 = Titanium.UI.createWindow(
{ backgroundColor : 'red', title : 'Red Window', }
);
var navWin = Titanium.UI.iOS.createNavigationWindow(
{ window : win1 }
);
win1.addEventListener("focus",function(e)
{ alert("hello"); Ti.API.info("Focus on first window"); }
);
navWin.open();
Case 2:
var win1 = Titanium.UI.createWindow(
{ backgroundColor : 'red', title : 'Red Window', }
);
var navWin = Titanium.UI.iOS.createNavigationWindow(
{ window : win1 }
);
var dialog = Ti.UI.createAlertDialog(
{ cancel: 1, buttonNames: ['Confirm', 'Cancel'], message: 'demo alert dialog?', title: 'Window Option' }
);
win1.addEventListener("focus",function(e)
{ dialog.show(); Ti.API.info("Focus on first window"); }
);
navWin.open();
You can copy the cases in app.'s file and test the same. You can also check the debug logs which shows focus event is continuously firing.
Attached are the files for both the test cases.
Execute the code to find the bug.
Attachments
File | Date | Size |
case1.js | 2015-05-11T05:24:44.000+0000 | 286 |
case2.js | 2015-05-11T05:24:44.000+0000 | 454 |