I'm trying to have a normal loop just rendering some views but it just goes of 1 time, basically it renders hours and then I check with other function if the hour is the same as the hours on my array and if it is I return the title of the hour that was appointment.
This is a function that I use from react-native-calendars, I don't think that i can do it really different because i need to return the <View> on the function.
renderItem(item) {
var cont = 0;
for (i = 0; i <= 23; i++) {
return (
<View style={[s.item, {height: item.height}]}>
<View>
<View style={{flexDirection: 'row',alignItems:'center'}}>
<Text>{item.name}{i}:00 </Text>
<View style={{borderBottomWidth: 1,flex:1,}}></View>
</View>
<TouchableOpacity style={{flexDirection: 'row',marginLeft: 35,borderColor: 'green',borderLeftWidth: 1,height: 50,backgroundColor:'#99ff99',opacity: 0.2}}>
<Text style={{marginLeft: 10,color:'white',opacity: 1}}>{this._checkHour(i)}</Text>
</TouchableOpacity>
</View>
</View>
);
}
}
_checkHour(i){
for (var k in GLOBAL.agenda){
console.log(i);
var horaDaLista = (GLOBAL.agenda[k] ? (GLOBAL.agenda[k].horaini ? GLOBAL.agenda[k].horaini.Hours : "") : "" ) ;
if(i==horaDaLista) {
console.log(GLOBAL.agenda[k].titulo);
return GLOBAL.agenda[k].titulo;
}
}
}