Former-commit-id: ac4548f63b
This commit is contained in:
Roman Volosovskyi 2016-05-16 13:40:43 +03:00
parent 4d9b81edf5
commit b893cce7bb
2 changed files with 26 additions and 24 deletions

View File

@ -11,6 +11,7 @@
[syng-im.chats-list.views.chat-list-item :refer [chat-list-item]] [syng-im.chats-list.views.chat-list-item :refer [chat-list-item]]
[syng-im.components.action-button :refer [action-button [syng-im.components.action-button :refer [action-button
action-button-item]] action-button-item]]
[syng-im.components.drawer :refer [drawer-view open-drawer]]
[syng-im.components.styles :refer [color-blue]] [syng-im.components.styles :refer [color-blue]]
[syng-im.components.toolbar :refer [toolbar]] [syng-im.components.toolbar :refer [toolbar]]
[syng-im.components.icons.ionicons :refer [icon]] [syng-im.components.icons.ionicons :refer [icon]]
@ -20,7 +21,7 @@
(defn chats-list-toolbar [] (defn chats-list-toolbar []
[toolbar {:nav-action {:image {:source {:uri :icon_hamburger} [toolbar {:nav-action {:image {:source {:uri :icon_hamburger}
:style st/hamburger-icon} :style st/hamburger-icon}
:handler (fn [])} :handler open-drawer}
:title "Chats" :title "Chats"
:action {:image {:source {:uri :icon_search} :action {:image {:source {:uri :icon_search}
:style st/search-icon} :style st/search-icon}
@ -29,6 +30,7 @@
(defn chats-list [] (defn chats-list []
(let [chats (subscribe [:get :chats])] (let [chats (subscribe [:get :chats])]
(fn [] (fn []
[drawer-view
[view st/chats-container [view st/chats-container
[chats-list-toolbar] [chats-list-toolbar]
[list-view {:dataSource (to-datasource (vals @chats)) [list-view {:dataSource (to-datasource (vals @chats))
@ -47,4 +49,4 @@
:buttonColor :#1abc9c :buttonColor :#1abc9c
:onPress #(dispatch [:show-group-new])} :onPress #(dispatch [:show-group-new])}
[icon {:name :person-stalker [icon {:name :person-stalker
:style st/person-stalker-icon}]]]]))) :style st/person-stalker-icon}]]]]])))

View File

@ -35,9 +35,9 @@
[text {:style st/menu-item-text} [text {:style st/menu-item-text}
name]]) name]])
(defn drawer-menu [navigator] (defn drawer-menu []
(let [username (subscribe [:get :username])] (let [username (subscribe [:get :username])]
(fn [navigator] (fn []
[view st/drawer-menu [view st/drawer-menu
[view st/user-photo-container [view st/user-photo-container
[user-photo {}]] [user-photo {}]]
@ -72,10 +72,10 @@
[text {:style st/switch-users-text} [text {:style st/switch-users-text}
"Switch users"]]]]))) "Switch users"]]]])))
(defn drawer-view [{:keys [navigator]} items] (defn drawer-view [items]
[drawer-layout-android {:drawerWidth 260 [drawer-layout-android {:drawerWidth 260
:drawerPosition js/React.DrawerLayoutAndroid.positions.Left :drawerPosition js/React.DrawerLayoutAndroid.positions.Left
:render-navigation-view #(r/as-element [drawer-menu navigator]) :render-navigation-view #(r/as-element [drawer-menu])
:ref (fn [drawer] :ref (fn [drawer]
(reset! drawer-atom drawer))} (reset! drawer-atom drawer))}
items]) items])