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 [seq-input {:command-width width
:container-width container-width}]]]))) :container-width container-width}]]])))
(defn commands-button [] (defview commands-button []
[react/touchable-highlight (letsubs [commands-responses [:get-available-commands-responses]]
{:on-press #(do (re-frame/dispatch [:set-chat-input-text constants/command-char]) (when (seq commands-responses)
(re-frame/dispatch [:chat-input-focus :input-ref])) [react/touchable-highlight
:accessibility-label :chat-commands-button} {:on-press #(do (re-frame/dispatch [:set-chat-input-text constants/command-char])
[react/view (re-frame/dispatch [:chat-input-focus :input-ref]))
[vi/icon :icons/input-commands {:container-style style/input-commands-icon :accessibility-label :chat-commands-button}
:color :dark}]]]) [react/view
[vi/icon :icons/input-commands {:container-style style/input-commands-icon
:color :dark}]]])))
(defview input-container [] (defview input-container []
(letsubs [margin [:chat-input-margin] (letsubs [margin [:chat-input-margin]