diff --git a/src/components/onboarding/screens/sign-in.tsx b/src/components/onboarding/screens/sign-in.tsx index c4ef8e98fc2..ce299daa78c 100644 --- a/src/components/onboarding/screens/sign-in.tsx +++ b/src/components/onboarding/screens/sign-in.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, createRef } from 'react'; import { Screen, ScreenBody, ScreenActions, Title, PoweredBy, ScreenFooter } from '@blockstack/connect'; import { ScreenHeader } from '@components/connected-screen-header'; import { Box, Text, Input, Flex, Button } from '@blockstack/ui'; @@ -14,6 +14,10 @@ import { selectAppName } from '@store/onboarding/selectors'; import { doStoreSeed } from '@store/wallet'; import { ErrorLabel } from '@components/error-label'; +const textAreaRef = createRef(); + +const hasLineReturn = (input: string) => input.includes('\n'); + interface SignInProps { next: () => void; back: () => void; @@ -72,9 +76,14 @@ export const SignIn: React.FC = props => { autoCapitalize="false" spellCheck={false} style={{ resize: 'none' }} - onChange={(evt: React.FormEvent) => { + ref={textAreaRef} + onChange={async (evt: React.FormEvent) => { setSeedError(null); setSeed(evt.currentTarget.value); + if (hasLineReturn(evt.currentTarget.value)) { + textAreaRef.current?.blur(); + await onSubmit(); + } }} /> {seedError && (