Polaris-react: ResourceList does not render item as per doc

Created on 26 Jul 2017  路  5Comments  路  Source: Shopify/polaris-react

Issue summary

Hi,

If I follow the documentation of ResourceList (https://polaris.shopify.com/components/lists/resource-list#navigation) the code should display the list item as per the example.

Actual behavior

Instead, because of the render function being empty, nothing is rendered. If I remove the renderFunction (hoping it would default to some sane defaults), it throws an exception due to missing render item function.

Specifications

  • Polaris version: 1.1.1
  • React version: 15.6

Most helpful comment

It looks like the renderItem function needs to be updated from:

renderItem={() => {}}

to

renderItem={(item, index) => {
  return <ResourceList.Item key={index} {...item} />;
}}

All 5 comments

EDIT : got it, the doc is not up to date with this document: https://github.com/Shopify/polaris/tree/master/src/components/ResourceList

I leave this issue open for now :).

Hey @bakura10, you鈥檙e right. Looks like an issue with the polaris site鈥攖he example code is loaded directly from that readme file, so something must be displaying wrong. We鈥檙e looking into it.

It looks like the renderItem function needs to be updated from:

renderItem={() => {}}

to

renderItem={(item, index) => {
  return <ResourceList.Item key={index} {...item} />;
}}

You鈥檙e totally right.

The content for each component page on polaris.shopify.com is parsed from the README in the codebase. The one for ResourceList is correct, so it looks like it鈥檚 not getting parsed correctly.

We鈥檒l get this fixed. Thanks for flagging it!

This is resolved in the latest resource list documentation: https://polaris.shopify.com/components/lists/resource-list

Was this page helpful?
0 / 5 - 0 ratings