Open RuairiOliver opened 6 years ago
I dont think that has to do with this component. When rendering a list you have to provide key attribute for each element. If you are using flatList, you will provide this function _keyExtractor = (item, index) => item.id;
Check FLatList in react native docs
Thanks, yeah I have a unique key on my flat list items. It's definitely this component.
The problem I think is that this component just uses the array index as the key.
I think the issue is that in a list their will be multiple buttons with the key 1 and 2 because it just uses the button array index.
Example: FlatList Item with unique key containing 2 rightButtons with key of 1 and 2 FlatList Item with unique key containing 2 rightButtons with key of 1 and 2
I can change this component to let me pass a unique key through which gets rid of the warning anyway.
Can u plz post a snippet of your code ? As I am not having any warning while using the flatList
Also seeing this error:
Exact same use case, rendering Swipeable
as a direct child of FlatList
.
The solution is to manually provide keys to your button elements.
Hi,
Has anyone used this component with a FlatList and experienced this issue with rightButtons?
"Each child in an array or iterator should have a unique "key" prop"
The component works great but the warning is irritating.
Thanks