From c0ea5a58178dcd4d0bda30d836b7542f0d6f142f Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Wed, 17 Aug 2022 09:21:03 +0800 Subject: [PATCH 1/2] Make sure we unsubscribe the pressOnEnter handler for the login form when we render the password form --- src/components/FormAlertWithSubmitButton.js | 6 ++++- src/pages/signin/LoginForm.js | 26 +++++++++++++-------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/components/FormAlertWithSubmitButton.js b/src/components/FormAlertWithSubmitButton.js index 93895ad15b07..6b68ae15a29e 100644 --- a/src/components/FormAlertWithSubmitButton.js +++ b/src/components/FormAlertWithSubmitButton.js @@ -31,6 +31,9 @@ const propTypes = { /** Submit function */ onSubmit: PropTypes.func.isRequired, + + /** Whether or not to pressOnEnter */ + pressOnEnter: PropTypes.bool, }; const defaultProps = { @@ -40,6 +43,7 @@ const defaultProps = { containerStyles: [], isLoading: false, onFixTheErrorsPressed: () => {}, + pressOnEnter: true, }; const FormAlertWithSubmitButton = props => ( @@ -60,7 +64,7 @@ const FormAlertWithSubmitButton = props => ( ) : (