Close sharing dialog on Enter when changing the username (#1437)

This commit is contained in:
Mohit kumar Bajoria 2020-04-17 01:32:59 +05:30 committed by GitHub
parent 8cfc64a3ab
commit 519a9ca493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,12 +15,14 @@ function RoomModal({
onUsernameChange,
onRoomCreate,
onRoomDestroy,
onPressingEnter,
}: {
activeRoomLink: string;
username: string;
onUsernameChange: (username: string) => void;
onRoomCreate: () => void;
onRoomDestroy: () => void;
onPressingEnter: () => void;
}) {
const roomLinkInput = useRef<HTMLInputElement>(null);
@ -85,6 +87,7 @@ function RoomModal({
value={username || ""}
className="RoomDialog-username TextInput"
onChange={(event) => onUsernameChange(event.target.value)}
onKeyPress={(event) => event.key === "Enter" && onPressingEnter()}
/>
</div>
<p>{`🔒 ${t("roomDialog.desc_privacy")}`}</p>
@ -173,6 +176,7 @@ export function RoomDialog({
onUsernameChange={onUsernameChange}
onRoomCreate={onRoomCreate}
onRoomDestroy={onRoomDestroy}
onPressingEnter={handleClose}
/>
</Dialog>
)}