parent
dacc9a5446
commit
b9c5d84e90
|
@ -42,36 +42,17 @@
|
||||||
:style st/search-icon}
|
:style st/search-icon}
|
||||||
:handler (fn [])}}]])
|
:handler (fn [])}}]])
|
||||||
|
|
||||||
(defn chats-list [{platform-specific :platform-specific}]
|
(defview chats-list [{platform-specific :platform-specific}]
|
||||||
(let [chats (subscribe [:get :chats])
|
[chats [:get :chats]]
|
||||||
chats-scrolled? (subscribe [:get :chats-scrolled?])
|
;; todo what is this?!
|
||||||
animation? (subscribe [:animations :tabs-bar-animation?])
|
#_(dispatch [:set :chats-scrolled? false])
|
||||||
tabs-bar-value (subscribe [:animations :tabs-bar-value])
|
|
||||||
container-height (r/atom 0)
|
|
||||||
content-height (r/atom 0)]
|
|
||||||
(dispatch [:set :chats-scrolled? false])
|
|
||||||
(fn []
|
|
||||||
[view st/chats-container
|
[view st/chats-container
|
||||||
[chats-list-toolbar platform-specific]
|
[chats-list-toolbar platform-specific]
|
||||||
[list-view {:dataSource (to-datasource @chats)
|
[list-view {:dataSource (to-datasource chats)
|
||||||
:renderRow (fn [row _ _]
|
:renderRow (fn [row _ _]
|
||||||
(list-item [chat-list-item row]))
|
(list-item [chat-list-item row]))
|
||||||
:style st/list-container
|
:style st/list-container}]
|
||||||
;;; if "maximizing" chat list will make scroll to 0,
|
[view {:style (st/action-buttons-container false 0)
|
||||||
;;; then disable maximazing
|
|
||||||
:onLayout (fn [event]
|
|
||||||
(when-not @chats-scrolled?
|
|
||||||
(let [height (.. event -nativeEvent -layout -height)]
|
|
||||||
(reset! container-height height))))
|
|
||||||
:onContentSizeChange (fn [width height]
|
|
||||||
(reset! content-height height))
|
|
||||||
:onScroll (fn [e]
|
|
||||||
(let [offset (.. e -nativeEvent -contentOffset -y)
|
|
||||||
min-content-height (+ @container-height tabs-height)
|
|
||||||
scrolled? (and (< 0 offset) (< min-content-height @content-height))]
|
|
||||||
(dispatch [:set :chats-scrolled? scrolled?])
|
|
||||||
(dispatch [:set-animation :tabs-bar-animation? true])))}]
|
|
||||||
[animated-view {:style (st/action-buttons-container @animation? (or @tabs-bar-value 0))
|
|
||||||
:pointerEvents :box-none}
|
:pointerEvents :box-none}
|
||||||
[action-button {:buttonColor color-blue
|
[action-button {:buttonColor color-blue
|
||||||
:offsetY 16
|
:offsetY 16
|
||||||
|
@ -88,4 +69,4 @@
|
||||||
:onPress #(dispatch [:show-group-new])}
|
:onPress #(dispatch [:show-group-new])}
|
||||||
[ion-icon {:name :md-person
|
[ion-icon {:name :md-person
|
||||||
:style st/person-stalker-icon}]]]]
|
:style st/person-stalker-icon}]]]]
|
||||||
[bottom-gradient]])))
|
[bottom-gradient]])
|
||||||
|
|
Loading…
Reference in New Issue