fix arrow alignment
Signed-off-by: yenda <eric@status.im>
This commit is contained in:
parent
a34ec7ffbe
commit
c6721dcdfc
|
@ -3,16 +3,8 @@
|
|||
(:require [clojure.string :as string]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.ui.screens.chat.styles.input.send-button :as style]
|
||||
[status-im.ui.components.animation :as animation]
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im.ui.components.icons.vector-icons :as vi]))
|
||||
|
||||
(defn send-button-view-on-update [{:keys [spin-value command-completion]}]
|
||||
(fn [_]
|
||||
(let [to-spin-value (if (#{:complete :no-command} command-completion) 1 0)]
|
||||
(animation/start
|
||||
(animation/timing spin-value {:toValue to-spin-value
|
||||
:duration 300})))))
|
||||
[status-im.ui.components.icons.vector-icons :as vector-icons]))
|
||||
|
||||
(defn sendable? [input-text disconnected? login-processing?]
|
||||
(let [trimmed (string/trim input-text)]
|
||||
|
@ -22,21 +14,16 @@
|
|||
disconnected?))))
|
||||
|
||||
(defview send-button-view []
|
||||
(letsubs [{:keys [command-completion]} [:chats/selected-chat-command]
|
||||
(letsubs [{:keys [command-completion]} [:chats/selected-chat-command]
|
||||
{:keys [input-text seq-arg-input-text]} [:chats/current-chat]
|
||||
disconnected? [:disconnected?]
|
||||
login-processing? [:get-in [:accounts/login :processing]]
|
||||
spin-value (animation/create-value 1)]
|
||||
{:component-did-update (send-button-view-on-update {:spin-value spin-value
|
||||
:command-completion command-completion})}
|
||||
disconnected? [:disconnected?]
|
||||
login-processing? [:get-in [:accounts/login :processing]]]
|
||||
(when (and (sendable? input-text disconnected? login-processing?)
|
||||
(or (not command-completion)
|
||||
(#{:complete :less-than-needed} command-completion)))
|
||||
[react/touchable-highlight {:on-press #(re-frame/dispatch [:chat.ui/send-current-message])}
|
||||
(let [spin (.interpolate spin-value (clj->js {:inputRange [0 1]
|
||||
:outputRange ["0deg" "90deg"]}))]
|
||||
[react/animated-view
|
||||
{:style (style/send-message-container spin)
|
||||
:accessibility-label :send-message-button}
|
||||
[vi/icon :main-icons/arrow-up {:container-style style/send-message-icon
|
||||
:color :white}]])])))
|
||||
[react/touchable-highlight
|
||||
{:on-press #(re-frame/dispatch [:chat.ui/send-current-message])}
|
||||
[vector-icons/icon :main-icons/arrow-up
|
||||
{:container-style style/send-message-container
|
||||
:accessibility-label :send-message-button
|
||||
:color :white}]])))
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
(ns status-im.ui.screens.chat.styles.input.send-button
|
||||
(:require [status-im.ui.components.colors :as colors]))
|
||||
|
||||
(defn send-message-container [rotation]
|
||||
(def send-message-container
|
||||
{:background-color colors/blue
|
||||
:width 30
|
||||
:height 30
|
||||
:padding 3
|
||||
:border-radius 15
|
||||
:margin 10
|
||||
:padding 4
|
||||
:margin-left 8
|
||||
:margin-bottom 11
|
||||
:transform [{:rotate rotation}]})
|
||||
|
||||
(def send-message-icon
|
||||
{:height 22
|
||||
:width 22})
|
||||
:margin-bottom 11})
|
||||
|
|
Loading…
Reference in New Issue