hide command button if there are no commands

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2018-04-05 11:54:25 +03:00
parent 26b0224236
commit 71ed35b480
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
1 changed files with 10 additions and 8 deletions

View File

@ -151,14 +151,16 @@
[seq-input {:command-width width
:container-width container-width}]]])))
(defn commands-button []
[react/touchable-highlight
{:on-press #(do (re-frame/dispatch [:set-chat-input-text constants/command-char])
(re-frame/dispatch [:chat-input-focus :input-ref]))
:accessibility-label :chat-commands-button}
[react/view
[vi/icon :icons/input-commands {:container-style style/input-commands-icon
:color :dark}]]])
(defview commands-button []
(letsubs [commands-responses [:get-available-commands-responses]]
(when (seq commands-responses)
[react/touchable-highlight
{:on-press #(do (re-frame/dispatch [:set-chat-input-text constants/command-char])
(re-frame/dispatch [:chat-input-focus :input-ref]))
:accessibility-label :chat-commands-button}
[react/view
[vi/icon :icons/input-commands {:container-style style/input-commands-icon
:color :dark}]]])))
(defview input-container []
(letsubs [margin [:chat-input-margin]