AddressBook: add missing key property to list items.

Well actually just remove the useless div, but the driver was
to add the missing key prop.
master
Tom Hacohen 5 years ago
parent effd74e0b2
commit 02ac73eb25

@ -50,6 +50,7 @@ function getContactColor(contact: ContactType) {
const AddressBookItem = React.memo((_props: any) => { const AddressBookItem = React.memo((_props: any) => {
const { const {
style,
entry, entry,
onClick, onClick,
} = _props; } = _props;
@ -57,6 +58,7 @@ const AddressBookItem = React.memo((_props: any) => {
return ( return (
<ListItem <ListItem
style={style}
leftIcon={ leftIcon={
<Avatar style={{ backgroundColor: getContactColor(entry) }}> <Avatar style={{ backgroundColor: getContactColor(entry) }}>
{name && name[0] && name[0].toUpperCase()} {name && name[0] && name[0].toUpperCase()}
@ -104,13 +106,12 @@ class AddressBook extends React.PureComponent<PropsType> {
rowHeight={56} rowHeight={56}
rowRenderer={({ index, key, style }) => { rowRenderer={({ index, key, style }) => {
return ( return (
<div style={style}> <AddressBookItem
<AddressBookItem key={key}
key={key} style={style}
entry={entries[index]} entry={entries[index]}
onClick={this.props.onItemClick} onClick={this.props.onItemClick}
/> />
</div>
); );
}} }}
/> />

Loading…
Cancel
Save