Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19883] iOS: Ti.UI.ActivityIndicatorStyle is undefined

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2015-11-06T01:19:36.000+0000
Affected Version/sRelease 5.0.2
Fix Version/sn/a
ComponentsiOS
Labelsactivityindicator
ReporterMathias Schmidt
AssigneeHans Knöchel
Created2015-11-04T11:14:21.000+0000
Updated2017-03-24T17:55:47.000+0000

Description

I try to use a activityIndicator, but get a redscreen everytime i set a style. It seems that Ti.UI.ActivityIndicatorStyle is undefined According to the docs this should work http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ActivityIndicator-property-style Created a new project in Titanium studio fith following code
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
 
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
 
 
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:'Tab 1',
    window:win1
});
 
var label1 = Titanium.UI.createLabel({
        color:'#999',
        text:'I am Window 1',
        font:{fontSize:20,fontFamily:'Helvetica Neue'},
        textAlign:'center',
        width:'auto'
});
 
  var activityIndicator = Ti.UI.createActivityIndicator({
    style: Ti.UI.ActivityIndicatorStyle.DARK, // redscreen: undefined is not an object (evaluating 'Ti.UI.ActivityIndicatorStyle.DARK')
    // style: 2, // works
    message: 'Loading...',
    color: '#000',
    top: 0,
    left: 0,
    height: 100,
    width: 100
  });
 
 
  win1.add(activityIndicator);
  activityIndicator.show();
 
win1.add(label1);
 
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({  
    title:'Tab 2',
    backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({  
    icon:'KS_nav_ui.png',
    title:'Tab 2',
    window:win2
});
 
var label2 = Titanium.UI.createLabel({
        color:'#999',
        text:'I am Window 2',
        font:{fontSize:20,fontFamily:'Helvetica Neue'},
        textAlign:'center',
        width:'auto'
});
 
win2.add(label2);
 
 
 
//
//  add tabs
//
tabGroup.addTab(tab1);  
tabGroup.addTab(tab2);  
 
 
// open tab group
tabGroup.open();

Comments

  1. Hans Knöchel 2015-11-06

    This bug is invalid: The user must have tested it with a Ti.SDK < 5.1.0. In that version, we did a parity feature to deprecate the Ti.UI.iPhone.ActivityIndicatorStyle namespace and make it possible under the Ti.UI.ActivityIndicatorStyle. So please use the old behavior on Ti.SDK before 5.1 and the normalized behavior on Ti.SDK 5.1.0 and later.
  2. Mathias Schmidt 2015-11-09

    Ti.UI.iPhone.ActivityIndicatorStyle doesn't work neither with the same red screen message. This is my updated test case:
         var activityIndicator = Ti.UI.createActivityIndicator({
           style: Ti.UI.iPhone.ActivityIndicatorStyle.DARK, // undefined is not an object (evaluating 'Ti.UI.iPhone.ActivityIndicatorStyle')
           // style: Ti.UI.ActivityIndicatorStyle.DARK, // redscreen: undefined is not an object (evaluating 'Ti.UI.ActivityIndicatorStyle.DARK')
           // style: 2, // works
           message: 'Loading...',
           color: '#000',
           top: 0,
           left: 0,
           height: 100,
           width: 100
         });
       
  3. Hans Knöchel 2015-11-09

    [~mathias.schmidt@pixell] Still not reproducible. Make sure to clean your project ("Project > Clean" in Studio) and then run this again:
       var win = Ti.UI.createWindow();
       
       var activityIndicator = Ti.UI.createActivityIndicator({
       	style : Ti.UI.iPhone.ActivityIndicatorStyle.DARK, //Works
       	message : 'Loading...',
       	color : '#000',
       	top : 0,
       	left : 0,
       	height : 100,
       	width : 100
       });
       
       win.add(activityIndicator);
       win.open();
       activityIndicator.show();
       
  4. Mathias Schmidt 2015-11-10

    Yes, (Ti.UI.iPhone.ActivityIndicatorStyle.DARK) works, but all others not. Is somewere documented which styles i have to use on SDK 3.5?
       var activityIndicator = Ti.UI.createActivityIndicator({
           // style : Ti.UI.iPhone.ActivityIndicatorStyle.BIG, // shows no indicator
           // style : Ti.UI.iPhone.ActivityIndicatorStyle.BIG_DARK, // shows no indicator
           style : Ti.UI.iPhone.ActivityIndicatorStyle.DARK, // shows a small black and white indicator
           // style : Ti.UI.iPhone.ActivityIndicatorStyle.PLAIN, // shows no indicator
           message : 'Loading...',
           color : '#000',
           top : 0,
           left : 0,
           height : 100,
           width : 100
       });
       
  5. Hans Knöchel 2015-11-11

    [~mathias.schmidt@pixell], your issue is describing the issue using 5.0.2.GA, the last comment says 3.5. What version are you actually testing? We can ensure, that all types of activity indicators work on every version, except BIG_DARK which is just as documented only available on Android, Windows Phone and MobileWeb. Here is another demo code which should be it. If you have further questions, please join our Q&A or Slack community for more help. Thanks!
       var win = Ti.UI.createWindow({
           backgroundColor: "#666",
           layout: "vertical"
       });
       var activityIndicator1 = Ti.UI.createActivityIndicator({
            style : Ti.UI.iPhone.ActivityIndicatorStyle.PLAIN,
            top : 20
       });
       
       var activityIndicator2 = Ti.UI.createActivityIndicator({
            style : Ti.UI.iPhone.ActivityIndicatorStyle.BIG,
            top : 20
       });
       
       var activityIndicator3 = Ti.UI.createActivityIndicator({
            style : Ti.UI.iPhone.ActivityIndicatorStyle.DARK,
            top : 20
       });
       
       win.add(activityIndicator1);
       win.add(activityIndicator2);
       win.add(activityIndicator3);
       
       win.open();
       
       activityIndicator1.show();
       activityIndicator2.show();
       activityIndicator3.show();
       
  6. Mathias Schmidt 2015-11-11

    Your example works in my environment. Thank you. Can't tell what the problem was before.
       [INFO] Titanium SDK version: 3.5.0.GA
       [INFO] iPhone Device family: iphone
       [INFO] iPhone SDK version: 6.0
       [INFO] iPhone simulated device: iphone
       
  7. Tim Poulsen 2015-11-20

    You know, it would be really nice if your documentation indicated that the Ti.UI.ActivityIndicator style constants are valid only for 5.1.0+. I just wasted a half hour fighting this only to find that it's a documentation issue. This ticket should not have been resolved as invalid. It should have been turned into a docs ticket.
  8. Hans Knöchel 2015-11-20

    [~timpoulsen] The docs have been updated too soon (for whatever reason). We are sorry for your time, but glad it's working now! 5.1.0 will most likely go live today, maybe thats a good consolation!
  9. Lee Morris 2017-03-24

    Closing ticket as invalid with reference to the above comments.

JSON Source