From b6903419a1112bae5397a398756e46a46afcf65f Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Tue, 19 Mar 2024 15:31:00 +0000 Subject: simplify gotoForm --- src/screens/Login/index.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/screens/Login/index.tsx b/src/screens/Login/index.tsx index 8dee06185..f7a0e29e9 100644 --- a/src/screens/Login/index.tsx +++ b/src/screens/Login/index.tsx @@ -65,7 +65,7 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => { setCurrentForm(Forms.Login) } - const gotoForm = (form: Forms) => () => { + const gotoForm = (form: Forms) => { setError('') setCurrentForm(form) } @@ -132,8 +132,8 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => { serviceDescription={serviceDescription} setError={setError} setServiceUrl={setServiceUrl} - onPressBack={gotoForm(Forms.Login)} - onEmailSent={gotoForm(Forms.SetNewPassword)} + onPressBack={() => gotoForm(Forms.Login)} + onEmailSent={() => gotoForm(Forms.SetNewPassword)} /> ) break @@ -145,15 +145,17 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => { error={error} serviceUrl={serviceUrl} setError={setError} - onPressBack={gotoForm(Forms.ForgotPassword)} - onPasswordSet={gotoForm(Forms.PasswordUpdated)} + onPressBack={() => gotoForm(Forms.ForgotPassword)} + onPasswordSet={() => gotoForm(Forms.PasswordUpdated)} /> ) break case Forms.PasswordUpdated: title = _(msg`Password updated`) description = _(msg`You can now sign in with your new password.`) - content = + content = ( + gotoForm(Forms.Login)} /> + ) break } -- cgit 1.4.1