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

View File

@ -50,8 +50,10 @@ const Accessory = ({ blockId, appId, element, parser }: IAccessory) =>
parser.renderAccessories({ blockId, appId, ...element }, BLOCK_CONTEXT.SECTION, parser); parser.renderAccessories({ blockId, appId, ...element }, BLOCK_CONTEXT.SECTION, parser);
const Fields = ({ fields, parser, theme }: IFields) => const Fields = ({ fields, parser, theme }: IFields) =>
fields.map((field: any) => ( fields.map((field: any, index: number) => (
<Text style={[styles.text, styles.field, { color: themes[theme].bodyText }]}>{parser.text(field)}</Text> <Text style={[styles.text, styles.field, { color: themes[theme].bodyText }]} key={index}>
{parser.text(field)}
</Text>
)); ));
const accessoriesRight = ['image', 'overflow']; 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> <Text style={[styles.itemLabel, { color: themes[theme].titleText }]}>{I18n.t('Tags')}</Text>
<View style={styles.cannedTagContainer}> <View style={styles.cannedTagContainer}>
{cannedResponse?.tags?.length > 0 ? ( {cannedResponse?.tags?.length > 0 ? (
cannedResponse.tags.map(t => ( cannedResponse.tags.map((t, index) => (
<View style={[styles.cannedTagWrap, { backgroundColor: themes[theme].searchboxBackground }]}> <View style={[styles.cannedTagWrap, { backgroundColor: themes[theme].searchboxBackground }]} key={index}>
<Text style={[styles.cannedTag, { color: themes[theme].auxiliaryTintColor }]}>{t}</Text> <Text style={[styles.cannedTag, { color: themes[theme].auxiliaryTintColor }]}>{t}</Text>
</View> </View>
)) ))

View File

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

View File

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

View File

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

View File

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