This commit is contained in:
Roman Volosovskyi 2016-11-30 17:00:29 +02:00
parent 04f040dd48
commit b3037c7263
2 changed files with 16 additions and 21 deletions

View File

@ -172,6 +172,8 @@
:padding-top 8 :padding-top 8
:padding-bottom 8}) :padding-bottom 8})
(def item-height 60)
(def bottom-info-row (def bottom-info-row
{:flex-direction "row" {:flex-direction "row"
:padding-top 4 :padding-top 4

View File

@ -21,11 +21,10 @@
(defn- container-animation-logic [{:keys [to-value val]}] (defn- container-animation-logic [{:keys [to-value val]}]
(fn [_] (fn [_]
(let [to-value @to-value]
(anim/start (anim/start
(anim/spring val {:toValue to-value (anim/spring val {:toValue to-value
:friction 6 :friction 6
:tension 40}))))) :tension 40}))))
(defn overlay [{:keys [on-click-outside]} items] (defn overlay [{:keys [on-click-outside]} items]
[view {:style st/bottom-info-overlay} [view {:style st/bottom-info-overlay}
@ -34,23 +33,18 @@
[view nil]] [view nil]]
items]) items])
(defn container [& _] (defn container [height & _]
(let [layout-height (r/atom 0) (let [anim-value (anim/create-value 1)
anim-value (anim/create-value 1) context {:to-value height
context {:to-value layout-height
:val anim-value} :val anim-value}
on-update (container-animation-logic context)] on-update (container-animation-logic context)]
(r/create-class (r/create-class
{:component-did-update {:component-did-update
on-update on-update
:reagent-render :reagent-render
(fn [& children] (fn [height & children]
@layout-height [animated-view {:style (st/bottom-info-container height)}
[animated-view {:style (st/bottom-info-container anim-value)} (into [view] children)])})))
(into [view {:onLayout (fn [event]
(let [height (.. event -nativeEvent -layout -height)]
(reset! layout-height height)))}]
children)])})))
(defn message-status-row [{:keys [photo-path name]} {:keys [whisper-identity status]}] (defn message-status-row [{:keys [photo-path name]} {:keys [whisper-identity status]}]
[view st/bottom-info-row [view st/bottom-info-row
@ -82,12 +76,11 @@
(map (fn [{:keys [identity]}] (map (fn [{:keys [identity]}]
[identity {:whisper-identity identity [identity {:whisper-identity identity
:status message-status}])) :status message-status}]))
(into {}))] (into {}))
statuses (vals (merge participants user-statuses))]
[overlay {:on-click-outside #(dispatch [:set-chat-ui-props :show-bottom-info? false])} [overlay {:on-click-outside #(dispatch [:set-chat-ui-props :show-bottom-info? false])}
[container [container (* st/item-height (count statuses))
[list-view {:dataSource (-> (merge participants user-statuses) [list-view {:dataSource (lw/to-datasource statuses)
(vals)
(lw/to-datasource))
:enableEmptySections true :enableEmptySections true
:renderRow (render-row @contacts) :renderRow (render-row @contacts)
:contentContainerStyle st/bottom-info-list-container}]]]))}))) :contentContainerStyle st/bottom-info-list-container}]]]))})))