refactor toolbar action

This commit is contained in:
Eric Dvorsak 2017-09-25 12:40:15 +02:00 committed by Roman Volosovskyi
parent 998df74b10
commit 17011f6d9e
1 changed files with 5 additions and 7 deletions

View File

@ -88,15 +88,13 @@
(defn toolbar-action []
(let [show-actions (subscribe [:chat-ui-props :show-actions?])]
(fn []
(if @show-actions
(let [show-actions @show-actions]
[touchable-highlight
{:on-press #(dispatch [:set-chat-ui-props {:show-actions? false}])}
{:on-press #(dispatch [:set-chat-ui-props {:show-actions? (not show-actions)}])}
[view st/action
[vi/icon :icons/dropdown-up]]]
[touchable-highlight
{:on-press #(dispatch [:set-chat-ui-props {:show-actions? true}])}
[view st/action
[chat-icon]]]))))
(if show-actions
[vi/icon :icons/dropdown-up]
[chat-icon])]]))))
(defview add-contact-bar []
[chat-id [:get :current-chat-id]