Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27636

Activity indicator not working without the setTimeout

    Details

    • Type: Bug
    • Status: Closed
    • Priority: None
    • Resolution: Cannot Reproduce
    • Affects Version/s: Release 8.2.1, Release 8.3.0
    • Fix Version/s: None
    • Component/s: Android, iOS
    • Labels:

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                fhaque Fazlul Haque (Inactive)
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration