From 810fe76c7c1b61c70af75db18a89480c3fa1e76d Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Wed, 15 Mar 2017 20:35:33 +0300 Subject: [PATCH] fixed address line on login and refreshed discover toolbar --- src/status_im/accounts/login/screen.cljs | 1 - src/status_im/components/toolbar_new/view.cljs | 9 ++++++++- src/status_im/discover/screen.cljs | 10 ++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/status_im/accounts/login/screen.cljs b/src/status_im/accounts/login/screen.cljs index 73faf4808e..d298b924bb 100644 --- a/src/status_im/accounts/login/screen.cljs +++ b/src/status_im/accounts/login/screen.cljs @@ -34,7 +34,6 @@ :label-color "#ffffff80" :line-color :white :input-style st/input-style - :wrapper-style (merge button-input st/address-input-wrapper) :on-change-text #(dispatch [:set-in [:login :address] %])}]]) (defview password-input [error] diff --git a/src/status_im/components/toolbar_new/view.cljs b/src/status_im/components/toolbar_new/view.cljs index 885afbe5f9..5b98f13599 100644 --- a/src/status_im/components/toolbar_new/view.cljs +++ b/src/status_im/components/toolbar_new/view.cljs @@ -68,6 +68,11 @@ (def search-text-input (r/atom nil)) +(defn- toolbar-search-submit [on-search-submit] + (let [text @(subscribe [:get-in [:toolbar-search :text]])] + (on-search-submit text) + (dispatch [:set-in [:toolbar-search :text] nil]))) + (defn- toolbar-with-search-content [{:keys [show-search? search-placeholder title @@ -80,7 +85,9 @@ :ref #(reset! search-text-input %) :auto-focus true :placeholder search-placeholder - :on-change-text #(dispatch [:set-in [:toolbar-search :text] %])}] + :on-change-text #(dispatch [:set-in [:toolbar-search :text] %]) + :on-submit-editing (when on-search-submit + #(toolbar-search-submit on-search-submit))}] (or custom-title [view [text {:style st/toolbar-title-text diff --git a/src/status_im/discover/screen.cljs b/src/status_im/discover/screen.cljs index ad77c850be..50692ab82e 100644 --- a/src/status_im/discover/screen.cljs +++ b/src/status_im/discover/screen.cljs @@ -8,8 +8,8 @@ text text-input icon]] - [status-im.components.toolbar.view :refer [toolbar-with-search]] - [status-im.components.toolbar.actions :as act] + [status-im.components.toolbar-new.view :refer [toolbar-with-search]] + [status-im.components.toolbar-new.actions :as act] [status-im.components.drawer.view :refer [open-drawer]] [status-im.components.carousel.carousel :refer [carousel]] [status-im.discover.views.popular-list :refer [discover-popular-list]] @@ -23,9 +23,10 @@ (let [hashtags (map #(str/lower-case (str/replace % #"#" "")) (re-seq #"[^ !?,;:.]+" status))] (or hashtags []))) -(defn toolbar-view [show-search?] +(defn toolbar-view [show-search? search-text] [toolbar-with-search {:show-search? show-search? + :search-text search-text :search-key :discover :title (label :t/discover) :search-placeholder (label :t/search-tags) @@ -74,12 +75,13 @@ (defview discover [current-view?] [show-search [:get-in [:toolbar-search :show]] + search-text [:get-in [:toolbar-search :text]] contacts [:get :contacts] current-account [:get-current-account] discoveries [:get-recent-discoveries]] [view st/discover-container [toolbar-view (and current-view? - (= show-search :discover))] + (= show-search :discover)) search-text] (if discoveries [scroll-view {:style (get-in platform-specific [:component-styles :main-tab-list])} [discover-popular {:contacts contacts