Nativebase: Multiple Arrays in Dynamic List

Created on 18 Apr 2017  路  9Comments  路  Source: GeekyAnts/NativeBase

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.

awaiting response

All 9 comments

+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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aloifolia picture aloifolia  路  3Comments

Bundas picture Bundas  路  3Comments

sihemhssine picture sihemhssine  路  3Comments

inv2004 picture inv2004  路  3Comments

omerdn1 picture omerdn1  路  3Comments