Search input on Discover can leave header in indeterminate state (#695)

This commit is contained in:
alwx 2017-01-14 17:15:10 +03:00
parent 42b14e71df
commit 9f5aee0146
1 changed files with 3 additions and 2 deletions

View File

@ -67,6 +67,8 @@
{:style st/toolbar-search-input
:auto-focus true
:placeholder search-placeholder
:return-key-type "search"
:on-blur #(dispatch [:set-in [:toolbar-search :show] nil])
:on-change-text #(dispatch [:set-in [:toolbar-search :text] %])
:on-submit-editing #(toolbar-search-submit on-search-submit)}]
[view
@ -82,8 +84,7 @@
on-search-submit]
:as opts}]
(let [toggle-search-fn #(dispatch [:set-in [:toolbar-search :show] %])
actions (if show-search?
[(act/search #(toolbar-search-submit on-search-submit))]
actions (if-not show-search?
(into actions [(act/search #(toggle-search-fn search-key))]))]
[toolbar {:style (merge st/toolbar-with-search style)
:nav-action (if show-search?