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 [] (defn toolbar-action []
(let [show-actions (subscribe [:chat-ui-props :show-actions?])] (let [show-actions (subscribe [:chat-ui-props :show-actions?])]
(fn [] (fn []
(if @show-actions (let [show-actions @show-actions]
[touchable-highlight [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 [view st/action
[vi/icon :icons/dropdown-up]]] (if show-actions
[touchable-highlight [vi/icon :icons/dropdown-up]
{:on-press #(dispatch [:set-chat-ui-props {:show-actions? true}])} [chat-icon])]]))))
[view st/action
[chat-icon]]]))))
(defview add-contact-bar [] (defview add-contact-bar []
[chat-id [:get :current-chat-id] [chat-id [:get :current-chat-id]