I have array of objects like the example below;
[{
\"id\" : 13100,
\"key\" : \"Emlak Vergisi\",
\"y\" : 135638.98
}, {
\"
I would say this approach is cleaner:
renderRow(rowData, sectionID, rowID) {
let style = [
styles.row,
{'backgroundColor': colors[rowID % colors.length]}
];
return ();
}
let colors = ['#123456', '#654321', '#fdecba', '#abcdef'];
let styles = StyleSheet.create({
row: {
// .. rows style
}
});
This way you can easily add a specail color to each row in the list (not only by even/odd type)