Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] 멤버 추가 시 제대로 작동하지 않는 문제 수정 #661

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/components/Design/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const Input: React.FC<InputProps> = forwardRef<HTMLInputElement, InputPro
onChange,
onFocus,
onBlur,
inputType,
inputType = 'input',
isError,
placeholder,
autoFocus,
Expand Down
15 changes: 6 additions & 9 deletions client/src/hooks/useMembersStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,16 @@ const useMembersStep = ({billInfo, setBillInfo, currentMembers, setStep}: Props)
};

const handleNameInputEnter = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter' && canAddMembers) {
if (event.key === 'Enter' && canAddMembers && inputRef.current) {
event.preventDefault();
if (!billInfo.members.map(({name}) => name).includes(nameInput)) {
setBillInfoMemberWithId(nameInput);
}
setNameInput('');
if (inputRef.current) {
setNameInput('');
inputRef.current.value = '';
inputRef.current.blur();
setTimeout(() => {
inputRef.current?.focus();
}, 0);
}
if (event.nativeEvent.isComposing) {
return;
if (inputRef.current) inputRef.current?.focus();
}, 10);
}
}
};
Expand Down
Loading