Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1225] If alert("hello") or AlertDialog show function is written on window focus event then window focus event is called infinite times.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2015-08-10T18:43:05.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsalert, alertdialog, event, focus, infinite, ios, issue, listener, times
ReporterMoizChhatriwala
AssigneeRadamantis Torres-Lechuga
Created2015-05-11T05:29:27.000+0000
Updated2016-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

FileDateSize
case1.js2015-05-11T05:24:44.000+0000286
case2.js2015-05-11T05:24:44.000+0000454

Comments

  1. Radamantis Torres-Lechuga 2015-08-10

JSON Source