-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix: Each child in a list should have a unique "key" prop #5443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
04e77c8
57719a6
c232b25
76392fb
29f7b55
044364c
35dee48
2cccebe
6150407
41c0562
61f6e5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| import { BlockContext } from '@rocket.chat/ui-kit'; | ||
| import React from 'react'; | ||
| import { StyleSheet, Text, View } from 'react-native'; | ||
| import { BlockContext } from '@rocket.chat/ui-kit'; | ||
|
|
||
| import { themes } from '../../lib/constants'; | ||
| import { IAccessoryComponent, IFields, ISection } from './interfaces'; | ||
| import { useTheme } from '../../theme'; | ||
| import { IAccessoryComponent, IFields, ISection } from './interfaces'; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| content: { | ||
|
|
@@ -30,8 +30,10 @@ const Accessory = ({ element, parser }: IAccessoryComponent) => | |
|
|
||
| const Fields = ({ fields, parser, theme }: IFields) => ( | ||
| <> | ||
| {fields.map(field => ( | ||
| <Text style={[styles.text, styles.field, { color: themes[theme].bodyText }]}>{parser.text(field)}</Text> | ||
| {fields.map((field, index) => ( | ||
| <Text key={index} style={[styles.text, styles.field, { color: themes[theme].bodyText }]}> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://react.dev/learn/rendering-lists#why-does-react-need-keys
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay sir. Thanks for pointing that out.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This issue has not yet been resolved.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sir I find this one trivial as the field is of type I would love to know suggestions. |
||
| {parser.text(field)} | ||
| </Text> | ||
| ))} | ||
| </> | ||
| ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.