I have a problem with titanium 3.5.0. When I want to position my ui element based on previous element in the layout with some methods like getWidth or getTop I'm getting Nan and in the console I'm getting a warning that says:
Invalid dimension value (nan) requested. Making the dimension undefined instead.
I have scrollview and I want to arrange my item into it so what I did
this is my scrollview code
var scrollView = Ti.UI.createScrollView({
contentWidth: 'auto',
contentHeight: 'auto',
backgroundColor:'#fff',
showVerticalScrollIndicator: false,
showHorizontalScrollIndicator: false,
height:"100%",
width: "100%",
top:36.6
});
and the scrollableview code
var view = Ti.UI.createView({
backgroundColor:'#fff',
borderRadius: 0,
height: 2000,
width: Ti.UI.FILL
});
and then I started adding my ui element in the view
var type =Ti.UI.createLabel({
text:"Type",
color:label_color,
right:207,
left:label_p_l,
font:{ fontFamily: customfont,fontSize:17},
top:37.5
});
var p_name=Ti.UI.createLabel({
text:"Property Name",
color:label_color,
left:label_p_l,
font:{ fontFamily: customfont,fontSize:17},
top:type.getTop()+label_h+32
});
so now it's working perfectly because type has a numeric value and even I added three more element in this way and every things works perfectly after that
I have added the 4th element like this and now when I started to get Nan.
var space_Slider = Titanium.UI.createSlider({
top:space.getTop()+space.getHeight()+15,
min:0,
max:1000,
value:0,
height:4,
backgroundColor:"#fff",
leftTrackImage:'/images/slider_color.png',
rightTrackImage:'/images/slider_color.png',
thumbImage:'/images/slider.png',
});
now the space.getTop() starts returning Nan
Any ideas how to solve this problem?