【问题标题】:how to get the array of object in react native如何在本机反应中获取对象数组
【发布时间】:2020-11-28 10:33:30
【问题描述】:

特此附上我的资料

{
  pageOfItems: [
    {
      __v: 0,
      _id: "5f10121efb43a43e30a4fbd2",
      brand: [Object],
      category: [Object],
      color: [Array],
      createdAt: "2020-07-16T08:38:37.787Z",
      description: "Full Sleeves, Na, Na",
      discountType: "Percentage",
      discountValue: 50.07153075822603,
      fabric: null,
      gender: [Object],
      itemcode: "MW4405",
      name: "Moda Grey Casual Shirts",
      photo: [Array],
      price: 699,
      quantity: 10,
      rotation: 0,
      shipping: true,
      size: [Array],
      sleeves: "5f0ffa443c7e14330408c285",
      sold: 0,
      status: "ON",
      store: "5f10119dbfe6ec3e38b0a71b",
      subcategory: "5f04732469c00914e0bb905c",
      updatedAt: "2020-07-16T08:38:37.787Z",
    },
  ],
};

如何进入flatlist请告诉我

【问题讨论】:

标签: react-native


【解决方案1】:

试试这个

const obj = {
  pageOfItems: [...],
};


<FlatList
  data={obj.pageOfItems}
  renderItem={({ item, index}) => (
    <View>
        <Text>{item.name}</Text>
    </View>
  )}
  keyExtractor={(item,index) => index.toString()}
/>

【讨论】:

  • 我存储的值说明如何获取它
  • 你想得到哪个值?
猜你喜欢
  • 1970-01-01
  • 2019-02-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-14
相关资源
最近更新 更多