我正在作为本地库我的前端库在react-native中进行移动应用程序开发。我想知道如何在nativebase中实现水平列表项
我知道我可以使用FlatList,但我对nativebase list组件感兴趣
// import components from native base
import { List, ListItem } from "native-base";
// lets assume your you have this array
let data=[
{
pet: 'gsd'
},
{
pet: 'husky'
},
{
pet: 'rotweiler'
}
];
// inside you render method return this component
return (
<List horizontal={true} dataArray={data} // your array should go here
renderRow={pet => (
<ListItem>
// if you want you can add a card item here, But I'm adding a simple text
<Text> {pet.name}
</Text>
</ListItem>
)}>
</List>
)