chore: resolving react/jsx-key error

This commit is contained in:
AlexAlexandre 2021-09-30 18:28:49 -03:00
parent d1287af814
commit d72f393de5
7 changed files with 18 additions and 12 deletions

View File

@ -16,7 +16,7 @@ interface IPasscodeDots {
const Dots = React.memo(({ passcode, theme, length }: IPasscodeDots) => (
<View style={styles.dotsContainer}>
{range(length).map(val => {
{range(length).map((val, index) => {
const lengthSup = passcode.length >= val + 1;
const height = lengthSup ? SIZE_FULL : SIZE_EMPTY;
const width = lengthSup ? SIZE_FULL : SIZE_EMPTY;
@ -30,7 +30,7 @@ const Dots = React.memo(({ passcode, theme, length }: IPasscodeDots) => (
const marginRight = lengthSup ? 10 - (SIZE_FULL - SIZE_EMPTY) / 2 : 10;
const marginLeft = lengthSup ? 10 - (SIZE_FULL - SIZE_EMPTY) / 2 : 10;
return (
<View style={styles.dotsView}>
<View style={styles.dotsView} key={index}>
<View
style={{
height,

View File

@ -50,8 +50,10 @@ const Accessory = ({ blockId, appId, element, parser }: IAccessory) =>
parser.renderAccessories({ blockId, appId, ...element }, BLOCK_CONTEXT.SECTION, parser);
const Fields = ({ fields, parser, theme }: IFields) =>
fields.map((field: any) => (
<Text style={[styles.text, styles.field, { color: themes[theme].bodyText }]}>{parser.text(field)}</Text>
fields.map((field: any, index: number) => (
<Text style={[styles.text, styles.field, { color: themes[theme].bodyText }]} key={index}>
{parser.text(field)}
</Text>
));
const accessoriesRight = ['image', 'overflow'];

View File

@ -140,8 +140,8 @@ const CannedResponseDetail = ({ navigation, route }) => {
<Text style={[styles.itemLabel, { color: themes[theme].titleText }]}>{I18n.t('Tags')}</Text>
<View style={styles.cannedTagContainer}>
{cannedResponse?.tags?.length > 0 ? (
cannedResponse.tags.map(t => (
<View style={[styles.cannedTagWrap, { backgroundColor: themes[theme].searchboxBackground }]}>
cannedResponse.tags.map((t, index) => (
<View style={[styles.cannedTagWrap, { backgroundColor: themes[theme].searchboxBackground }]} key={index}>
<Text style={[styles.cannedTag, { color: themes[theme].auxiliaryTintColor }]}>{t}</Text>
</View>
))

View File

@ -32,8 +32,8 @@ const CannedResponseItem = ({ theme, onPressDetail, shortcut, scope, onPressUse,
</Text>
<View style={styles.cannedTagContainer}>
{tags?.length > 0
? tags.map(t => (
<View style={[styles.cannedTagWrap, { backgroundColor: themes[theme].searchboxBackground }]}>
? tags.map((t, index) => (
<View style={[styles.cannedTagWrap, { backgroundColor: themes[theme].searchboxBackground }]} key={index}>
<Text style={[styles.cannedTag, { color: themes[theme].auxiliaryTintColor }]}>{t}</Text>
</View>
))

View File

@ -230,6 +230,7 @@ const LivechatEditView = ({ user, navigation, route, theme, editOmnichannelConta
}}
theme={theme}
editable={!!permissions[0]}
key={index}
/>
))}
<Title title={I18n.t('Conversation')} theme={theme} />
@ -276,6 +277,7 @@ const LivechatEditView = ({ user, navigation, route, theme, editOmnichannelConta
}}
theme={theme}
editable={!!permissions[1]}
key={index}
/>
))}

View File

@ -666,8 +666,10 @@ class RoomInfoEditView extends React.Component {
) : null}
{room.broadcast
? [
<Text style={styles.broadcast}>{I18n.t('Broadcast_Channel')}</Text>,
<View style={[styles.divider, { borderColor: themes[theme].separatorColor }]} />
<Text style={styles.broadcast} key={0}>
{I18n.t('Broadcast_Channel')}
</Text>,
<View style={[styles.divider, { borderColor: themes[theme].separatorColor }]} key={1} />
]
: null}
{!compareServerVersion(serverVersion, '3.0.0', methods.lowerThan) ? (

View File

@ -5,11 +5,11 @@ import Item from './Item';
const CustomFields = ({ customFields, theme }) => {
if (customFields) {
return Object.keys(customFields).map(title => {
return Object.keys(customFields).map((title, index) => {
if (!customFields[title]) {
return;
}
return <Item label={title} content={customFields[title]} theme={theme} />;
return <Item label={title} content={customFields[title]} theme={theme} key={index} />;
});
}