【问题标题】:How to create a horizontal list with nativebase如何使用 nativebase 创建水平列表
【发布时间】:2019-11-24 15:02:02
【问题描述】:

我正在将 react-native 中的移动应用程序开发作为 nativebase 我的前端库。我想知道如何在 nativebase 中实现水平列表项

我知道我可以使用 FlatList,但我对 nativebase 列表组件感兴趣

【问题讨论】:

标签: react-native listview native-base


【解决方案1】:
// 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>

)

【讨论】:

    猜你喜欢
    • 2015-03-06
    • 1970-01-01
    • 2015-05-05
    • 1970-01-01
    • 2020-08-16
    • 1970-01-01
    • 2021-11-26
    • 2021-04-09
    • 2015-06-23
    相关资源
    最近更新 更多