From b3037c726325150a644e6d614626a1161b707c74 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 30 Nov 2016 17:00:29 +0200 Subject: [PATCH] fix #509 --- src/status_im/chat/styles/screen.cljs | 2 ++ src/status_im/chat/views/bottom_info.cljs | 35 +++++++++-------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/status_im/chat/styles/screen.cljs b/src/status_im/chat/styles/screen.cljs index 1f92177120..a0757d6fd0 100644 --- a/src/status_im/chat/styles/screen.cljs +++ b/src/status_im/chat/styles/screen.cljs @@ -172,6 +172,8 @@ :padding-top 8 :padding-bottom 8}) +(def item-height 60) + (def bottom-info-row {:flex-direction "row" :padding-top 4 diff --git a/src/status_im/chat/views/bottom_info.cljs b/src/status_im/chat/views/bottom_info.cljs index 82eb93cf68..72aec7eaf4 100644 --- a/src/status_im/chat/views/bottom_info.cljs +++ b/src/status_im/chat/views/bottom_info.cljs @@ -21,11 +21,10 @@ (defn- container-animation-logic [{:keys [to-value val]}] (fn [_] - (let [to-value @to-value] - (anim/start - (anim/spring val {:toValue to-value - :friction 6 - :tension 40}))))) + (anim/start + (anim/spring val {:toValue to-value + :friction 6 + :tension 40})))) (defn overlay [{:keys [on-click-outside]} items] [view {:style st/bottom-info-overlay} @@ -34,23 +33,18 @@ [view nil]] items]) -(defn container [& _] - (let [layout-height (r/atom 0) - anim-value (anim/create-value 1) - context {:to-value layout-height +(defn container [height & _] + (let [anim-value (anim/create-value 1) + context {:to-value height :val anim-value} on-update (container-animation-logic context)] (r/create-class {:component-did-update on-update :reagent-render - (fn [& children] - @layout-height - [animated-view {:style (st/bottom-info-container anim-value)} - (into [view {:onLayout (fn [event] - (let [height (.. event -nativeEvent -layout -height)] - (reset! layout-height height)))}] - children)])}))) + (fn [height & children] + [animated-view {:style (st/bottom-info-container height)} + (into [view] children)])}))) (defn message-status-row [{:keys [photo-path name]} {:keys [whisper-identity status]}] [view st/bottom-info-row @@ -82,12 +76,11 @@ (map (fn [{:keys [identity]}] [identity {:whisper-identity identity :status message-status}])) - (into {}))] + (into {})) + statuses (vals (merge participants user-statuses))] [overlay {:on-click-outside #(dispatch [:set-chat-ui-props :show-bottom-info? false])} - [container - [list-view {:dataSource (-> (merge participants user-statuses) - (vals) - (lw/to-datasource)) + [container (* st/item-height (count statuses)) + [list-view {:dataSource (lw/to-datasource statuses) :enableEmptySections true :renderRow (render-row @contacts) :contentContainerStyle st/bottom-info-list-container}]]]))})))