From 89643b425eccecac069c761b059fa89056acf1ce Mon Sep 17 00:00:00 2001 From: Dmitry Novotochinov Date: Mon, 13 May 2019 21:53:36 +0300 Subject: [PATCH] [#8187] fix keyboard pop-up when logout after keycard setup finished Signed-off-by: Dmitry Novotochinov --- src/status_im/hardwallet/core.cljs | 7 +++++-- .../ui/screens/accounts/login/views.cljs | 5 +++-- .../ui/screens/hardwallet/components.cljs | 6 ++++-- .../ui/screens/hardwallet/setup/styles.cljs | 4 ++-- .../ui/screens/hardwallet/setup/views.cljs | 15 +++++++++++---- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/status_im/hardwallet/core.cljs b/src/status_im/hardwallet/core.cljs index c5f4ce1f0f..1c61b9c177 100644 --- a/src/status_im/hardwallet/core.cljs +++ b/src/status_im/hardwallet/core.cljs @@ -814,14 +814,17 @@ [{:keys [db] :as cofx}] (let [pin (vector->string (get-in db [:hardwallet :pin :current])) pairing (get-pairing db) - card-connected? (get-in db [:hardwallet :card-connected?])] + card-connected? (get-in db [:hardwallet :card-connected?]) + setup? (boolean (get-in db [:hardwallet :setup-step]))] (if card-connected? {:db (assoc-in db [:hardwallet :pin :status] :verifying) :hardwallet/verify-pin {:pin pin :pairing pairing}} (fx/merge cofx {:db (assoc-in db [:hardwallet :on-card-connected] :hardwallet/verify-pin)} - (navigation/navigate-to-cofx :hardwallet-connect-settings nil))))) + (navigation/navigate-to-cofx (if setup? + :hardwallet-connect + :hardwallet-connect-settings) nil))))) (defn- unblock-pin [{:keys [db] :as cofx}] diff --git a/src/status_im/ui/screens/accounts/login/views.cljs b/src/status_im/ui/screens/accounts/login/views.cljs index 034e71e7e6..cf517bdaf6 100644 --- a/src/status_im/ui/screens/accounts/login/views.cljs +++ b/src/status_im/ui/screens/accounts/login/views.cljs @@ -59,7 +59,8 @@ (letsubs [{:keys [photo-path name error processing save-password? can-save-password?]} [:accounts/login] can-navigate-back? [:can-navigate-back?] password-text-input (atom nil) - sign-in-enabled? [:sign-in-enabled?]] + sign-in-enabled? [:sign-in-enabled?] + view-id [:view-id]] [react/keyboard-avoiding-view {:style ast/accounts-view} [status-bar/status-bar] [login-toolbar can-navigate-back?] @@ -72,7 +73,7 @@ {:label (i18n/label :t/password) :placeholder (i18n/label :t/password) :ref #(reset! password-text-input %) - :auto-focus true + :auto-focus (= view-id :login) :on-submit-editing (when sign-in-enabled? #(login-account @password-text-input)) :on-change-text #(do diff --git a/src/status_im/ui/screens/hardwallet/components.cljs b/src/status_im/ui/screens/hardwallet/components.cljs index 0dac449c67..3551aacc63 100644 --- a/src/status_im/ui/screens/hardwallet/components.cljs +++ b/src/status_im/ui/screens/hardwallet/components.cljs @@ -73,8 +73,10 @@ [react/text {:style styles/maintain-card-second-step-text} (str second-number ". " (i18n/label second-label))]) (when third-label - [react/text {:style styles/maintain-card-third-step-text} - (str third-number ". " (i18n/label third-label))])] + [react/view {:flex 1} + [react/text {:style styles/maintain-card-third-step-text + :number-of-lines 1} + (str third-number ". " (i18n/label third-label))]])] [react/text {:style styles/maintain-card-text :number-of-lines 2} (i18n/label :t/maintain-card-to-phone-contact)]))) diff --git a/src/status_im/ui/screens/hardwallet/setup/styles.cljs b/src/status_im/ui/screens/hardwallet/setup/styles.cljs index 0d19264e42..d7a6edb7b6 100644 --- a/src/status_im/ui/screens/hardwallet/setup/styles.cljs +++ b/src/status_im/ui/screens/hardwallet/setup/styles.cljs @@ -37,8 +37,8 @@ :flex 1 :width "95%" :background-color :white - :padding-left 20 - :margin-right 20}) + :padding-left 10 + :margin-right 10}) (def maintain-card-current-step-text {:typography :caption diff --git a/src/status_im/ui/screens/hardwallet/setup/views.cljs b/src/status_im/ui/screens/hardwallet/setup/views.cljs index 73ed5b8b90..4b512104df 100644 --- a/src/status_im/ui/screens/hardwallet/setup/views.cljs +++ b/src/status_im/ui/screens/hardwallet/setup/views.cljs @@ -222,10 +222,19 @@ (display-recovery-phrase) (enter-recovery-phrase)))) +(defview enter-pair-code-input [ref] + {:component-will-update #(.clear @ref)} + [text-input/text-input-with-label + {:on-change-text #(re-frame/dispatch [:hardwallet.ui/pair-code-input-changed %]) + :auto-focus true + :ref (partial reset! ref) + :placeholder ""}]) + (defview enter-pair-code [] (letsubs [pair-code [:hardwallet-pair-code] error [:hardwallet-setup-error] - width [:dimensions/window-width]] + width [:dimensions/window-width] + ref (atom nil)] [react/scroll-view [react/view styles/enter-pair-code-container [react/view styles/enter-pair-code-title-container @@ -241,9 +250,7 @@ :color colors/red}} error]]) [react/view (styles/enter-pair-code-input-container width) - [text-input/text-input-with-label - {:on-change-text #(re-frame/dispatch [:hardwallet.ui/pair-code-input-changed %]) - :placeholder ""}]]] + [enter-pair-code-input ref]]] [react/view styles/next-button-container [react/view components.styles/flex] [react/view {:margin-right 20}