Hello, I'm wondering if there is a way to iterate through more than one array when creating a dynamic list?
e.g.
<Container>
<Content>
<List dataArray={items, items2} renderRow={(data,data2) =>
<ListItem>
<Text>{data}</Text>
<Text note>{data2}</Text>
</ListItem>
} />
</Content>
</Container>
Could this be done? What's the correct syntax because the above doesn't work! Any help would be much appreciated.
+1 SO
@rostyys Did you try implementing this with React Native?
@SupriyaKalghatgi Yes, in a react native project.
@rostyys I meant, did you try running with React Native component, without NativeBase?
@rostyys Any updates on this?
@SupriyaKalghatgi I have no tried with React Native component. Could you possible specify what I should try?
Did you try the above implementation with React Native pure components?
I mean without using NativeBase
dataArray of NativeBase List accepts a single array just like dataSource of ReactNative ListView which accepts a single object
render(){
var product = [];
for(var i = 0; i < 15; i++){
product.push({'name': 'Apple', 'price' : '$6'});
}
return(
<List dataArray={product}
renderRow={(product) =>
<ListItem>
<Text>{product.name}</Text>
<Text note>{product.price}</Text>
</ListItem>
}>
</List>
);
}
It's worked for me.