Warning: Each child in a list should have a unique "key" prop. Stack Component
inidaname opened this issue · 1 comments
inidaname commented
Using the stack component and I encountered this error
ERROR Warning: Each child in a list should have a unique "key" prop.
Check the render method of `Stack`. See https://reactjs.org/link/warning-keys for more information.
in Stack (created by HStack)
in HStack (created by ScreenOne)
in RCTView (created by View)
in View (created by ImageBackground)
in ImageBackground (created by Box)
in Box (created by ScreenOne)
in ScreenOne (created by Index)
in RCTView (created by View)
in View (created by _default)
in AndroidHorizontalScrollContentView (created by ScrollView)
in AndroidHorizontalScrollView (created by ScrollView)
in ScrollView (created by ScrollView)
in ScrollView (created by _default)
in RCTView (created by View)
in View (created by _default)
in _default (created by Index)
in RCTView (created by View)
in View (created by Box)
in Box (created by Index)
in Index (created by App)
in ThemeProvider (created by AppProvider)
in PersistGate (created by AppProvider)
in Provider (created by AppProvider)
in EnsureSingleNavigator
in BaseNavigationContainer
in ThemeProvider
in NavigationContainerInner (created by AppProvider)
in AppProvider (created by App)
in App
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in kaderiryder(RootComponent)
I dig through and noticed this, I made improvmement and I will love to send a PR.
<>
<RNView key={`stack-${index}`}>{item}</RNView>
{index !== children.length - 1 ? (
<RNView style={computedStyle.stackSpacing} />
) : null}
</>
Here is my suggest improvement
<RNView key={`stack-${index}`}>
{item}
{index !== children.length - 1 ? (
<RNView style={computedStyle.stackSpacing} />
) : null}
</RNView>
ntorionbearstudio commented
Thank you @inidaname for the feedback, the error has been fixed on 1.0.0-alpha13
package
Here is the commit of the fix : b2842dc