Skip to content

Commit

Permalink
Update index.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
hengkx committed Oct 24, 2020
1 parent 7387fc4 commit a7184eb
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions components/select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,21 @@ const InternalSelect = <VT extends SelectValue = SelectValue>(
} = React.useContext(ConfigContext);
const size = React.useContext(SizeContext);

const getMode = () => {
const { mode } = props as InternalSelectProps<VT>;
const prefixCls = getPrefixCls('select', customizePrefixCls);

const mode = React.useMemo(() => {
const { mode: m } = props as InternalSelectProps<VT>;

if ((mode as any) === 'combobox') {
if ((m as any) === 'combobox') {
return undefined;
}

if (mode === SECRET_COMBOBOX_MODE_DO_NOT_USE) {
if (m === SECRET_COMBOBOX_MODE_DO_NOT_USE) {
return 'combobox';
}

return mode;
};

const prefixCls = getPrefixCls('select', customizePrefixCls);
const mode = getMode();
return m;
}, [props.mode]);

const isMultiple = mode === 'multiple' || mode === 'tags';

Expand Down

0 comments on commit a7184eb

Please sign in to comment.