question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Key issues when using FlatList

See original GitHub issue

When trying to render swipeable in FlatList component, i get the following error:

ExceptionsManager.js:71 Warning: Each child in an array or iterator should have a unique “key” prop.

Check the render method of Swipeable. It was passed a child from DiscogsSearch. See https://fb.me/react-warning-keys for more information.

Is Swipeable compatible with Flatlist?

Also the swipe actions fire multiple times on one swipe, but i’m not sure if that is a related issue.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
powdahoundcommented, Sep 19, 2017

Had this issue as well, though it was only showing up on iOS. Resolved it by adding a key prop to the highest level component to my Swipeable’s rightContent (a <View> in my case).

1reaction
martimarkovcommented, Sep 8, 2017

Check #3

As for the key prop, you either have to pass the key prop to your renderItem function:

          <Swipeable
            key={item.id}
           >
          {item.title}
          </Swipeable>
        )}

or implement keyExtractor for the FlatList:

_keyExtractor = (item, index) => item.id;

           <FlatList 
            keyExtractor={this._keyExtractor}
           ...

           </FlatList>
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can resolve problem of Key in FlatList React native
Well, you've some data in your array that has a duplicate id property. Fix your data or select a better, more unique property...
Read more >
8 ways to optimize React native FlatList performance
React native FlatList can have performance issues sometimes depending ... As a rule of thumb in react, Always use keys for your list...
Read more >
A deep dive into React Native FlatList - LogRocket Blog
Common problems and questions · Images do not render · Inverting the list · The list should re-render when a variable changes ·...
Read more >
Optimizing Flatlist Configuration - React Native
Blank areas: When VirtualizedList can't render your items fast enough, you may enter a part of your list with non-rendered components that ...
Read more >
A guide to optimizing Flatlists in React Native. - Obytes
Use Key Extractor · Avoid anonymous functions · Get Item layout · MaxToRenderPerBatch · Profiling · Optimize your images · useMemo & useCallback....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found