mirror of https://github.com/buster-so/buster.git
press enter invite
This commit is contained in:
parent
62d13729fb
commit
f53bc01955
|
@ -59,6 +59,7 @@ export const InvitePeopleModal: React.FC<{
|
|||
<InputTagInput
|
||||
tags={emails}
|
||||
onChangeText={setInputText}
|
||||
onPressEnter={handleInvite}
|
||||
onTagAdd={(v) => {
|
||||
const arrayedTags = Array.isArray(v) ? v : [v];
|
||||
const hadMultipleTags = arrayedTags.length > 1;
|
||||
|
|
|
@ -12,6 +12,7 @@ export interface TagInputProps extends VariantProps<typeof inputVariants> {
|
|||
onTagAdd?: (tag: string | string[]) => void;
|
||||
onTagRemove?: (index: number) => void;
|
||||
onChangeText?: (text: string) => void;
|
||||
onPressEnter?: () => void;
|
||||
placeholder?: string;
|
||||
disabled?: boolean;
|
||||
maxTags?: number;
|
||||
|
@ -29,6 +30,7 @@ const InputTagInput = React.forwardRef<HTMLInputElement, TagInputProps>(
|
|||
onTagAdd,
|
||||
onTagRemove,
|
||||
onChangeText,
|
||||
onPressEnter,
|
||||
placeholder,
|
||||
disabled = false,
|
||||
maxTags,
|
||||
|
@ -80,6 +82,10 @@ const InputTagInput = React.forwardRef<HTMLInputElement, TagInputProps>(
|
|||
} else if (e.key === 'Backspace' && inputValue === '' && tags.length > 0 && !disabled) {
|
||||
onTagRemove?.(tags.length - 1);
|
||||
}
|
||||
|
||||
if (e.key === 'Enter' && inputValue.trim() === '') {
|
||||
onPressEnter?.();
|
||||
}
|
||||
});
|
||||
|
||||
const handleInputChange = useMemoizedFn((e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
|
|
Loading…
Reference in New Issue