Add headers to InputAddress list (#2345)

This commit is contained in:
Jaco Greeff 2020-03-08 20:14:40 +01:00 committed by GitHub
parent 06c0371fea
commit b34982fda5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -10,6 +10,9 @@ import Dropdown from '../Dropdown';
export default function createHeader (option: KeyringSectionOption): React.ReactNode {
return (
<Dropdown.Header content={option.name} />
<Dropdown.Header
key={option.key || option.name}
content={option.name}
/>
);
}

View File

@ -222,7 +222,7 @@ class InputAddress extends React.PureComponent<Props, State> {
return !optionsAll
? []
: optionsAll[type].filter(({ value }): boolean => !!value && (!filter || filter.includes(value)));
: optionsAll[type].filter(({ value }): boolean => !filter || (!!value && filter.includes(value)));
}
private onChange = (address: string): void => {
@ -250,17 +250,13 @@ class InputAddress extends React.PureComponent<Props, State> {
const query = _query.trim();
const queryLower = query.toLowerCase();
const matches = filteredOptions.filter((item): boolean =>
item.value !== null && (
!!item.value && (
(item.name.toLowerCase && item.name.toLowerCase().includes(queryLower)) ||
item.value.toLowerCase().includes(queryLower)
)
);
const valueMatches = matches.filter((item): boolean =>
item.value !== null
);
if (isInput && valueMatches.length === 0) {
if (isInput && matches.length === 0) {
const accountId = transformToAccountId(query);
if (accountId) {