Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27636] Activity indicator not working without the setTimeout

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionCannot Reproduce
Resolution Date2020-04-07T00:23:21.000+0000
Affected Version/sRelease 8.2.1, Release 8.3.0
Fix Version/sn/a
ComponentsAndroid, iOS
LabelsengSchedule
ReporterFazlul Haque
AssigneeUnknown
Created2019-11-27T13:32:08.000+0000
Updated2020-04-07T00:23:21.000+0000

Description

Hello, As we can see the activityIndicator is not working without the SetTime out for Android and iOS. Please have a look at the following code and working environment: *Test Environment:* Operating System Appcelerator Command-Line Interface, version 7.1.1 Name = Mac OS X Version = 10.14.6 Node.js Node.js Version = 8.9.1 npm Version = 5.5.1 Titanium CLI CLI Version = 5.2.1 Titanium SDK SDK Version = 8.2.1.GA, 8.3.0.GA Target Platform = iphone, Android *Test Code:*
Ti.UI.backgroundColor = 'white';

var win1 = Ti.UI.createWindow({
	backgroundColor : 'white'
});

var win2 = Ti.UI.createWindow({
	backgroundColor : 'yellow'
});

var activityIndicator = Ti.UI.createActivityIndicator({
	color : 'green',
	message : 'Loading ...',
	style : Ti.UI.ActivityIndicatorStyle.DARK,
	top : 100,
	left : 100,
	height : Ti.UI.SIZE,
	width : Ti.UI.SIZE
});

// The activity indicator must be added to a window or view for it to appear
win2.add(activityIndicator);

// eventListeners must always be loaded before the event is likely to fire
// hence, the open() method must be positioned before the window is opened
win2.addEventListener('open', function(e) {
	activityIndicator.show();
	// do some work that takes 6 seconds
	// ie. replace the following setTimeout block with your code
	
	//setTimeout(function() { .             // If we unblock this the activityIndicator will be shown
		for (var i=40000; i>0; i--){
		Ti.API.info("Test: "+i); 	
		}
        
		e.source.close();
		activityIndicator.hide();
	//}, 6000);                              // If we unblock this the activityIndicator will be shown
});
win1.open();
win2.open(); 
*Note:* If you can just unblock the setTimeout function then the code will work fine. Thanks

Comments

No comments

JSON Source