Request icon in message is overlapped by the next message fix (#400)

Former-commit-id: f1b687872b0f171cfaa9b692aedd0573631809f6
This commit is contained in:
Alexander Pantyuhov 2016-11-03 14:16:04 +03:00
parent 83d32e79e7
commit 82b3587fb0
2 changed files with 13 additions and 6 deletions

View File

@ -140,9 +140,9 @@
(def command-request-from-text
(merge style-sub-text {:marginBottom 2}))
(def command-request-image-touchable
(defn command-request-image-touchable [top-offset?]
{:position :absolute
:top 4
:top (if top-offset? 4 -1)
:right -8
:alignItems :center
:justifyContent :center

View File

@ -43,7 +43,7 @@
(anim/start
(button-animation val min-scale loop? answered?)))))
(defn request-button [message-id command status-initialized?]
(defn request-button [message-id command status-initialized? top-offset?]
(let [scale-anim-val (anim/create-value min-scale)
answered? (subscribe [:is-request-answered? message-id])
loop? (r/atom true)
@ -62,7 +62,7 @@
[touchable-highlight
{:on-press (when (and (not @answered?) status-initialized?)
#(set-chat-command message-id command))
:style st/command-request-image-touchable
:style (st/command-request-image-touchable top-offset?)
:accessibility-label (label command)}
[animated-view {:style (st/command-request-image-view command scale-anim-val)}
(when command-icon
@ -70,7 +70,8 @@
(defn message-content-command-request
[{:keys [message-id content from incoming-group]}]
(let [commands-atom (subscribe [:get-responses])
(let [top-offset (r/atom {:specified? false})
commands-atom (subscribe [:get-responses])
answered? (subscribe [:is-request-answered? message-id])
status-initialized? (subscribe [:get :status-module-initialized?])]
(fn [{:keys [message-id content from incoming-group]}]
@ -86,6 +87,11 @@
:font :default}
from])
[text {:style st/style-message-text
:on-layout #(reset! top-offset {:specified? true
:value (-> (.-nativeEvent %)
(.-layout)
(.-height)
(> 25))})
:font :default}
content]]]
(when (:request-text command)
@ -93,4 +99,5 @@
[text {:style st/style-sub-text
:font :default}
(:request-text command)]])
[request-button message-id command @status-initialized?]]))))
(when (:specified? @top-offset)
[request-button message-id command @status-initialized? (:value @top-offset)])]))))