diff --git a/src/syng_im/chats_list/screen.cljs b/src/syng_im/chats_list/screen.cljs index 5d0092fc98..f13e07c24c 100644 --- a/src/syng_im/chats_list/screen.cljs +++ b/src/syng_im/chats_list/screen.cljs @@ -11,6 +11,7 @@ [syng-im.chats-list.views.chat-list-item :refer [chat-list-item]] [syng-im.components.action-button :refer [action-button action-button-item]] + [syng-im.components.drawer :refer [drawer-view open-drawer]] [syng-im.components.styles :refer [color-blue]] [syng-im.components.toolbar :refer [toolbar]] [syng-im.components.icons.ionicons :refer [icon]] @@ -20,7 +21,7 @@ (defn chats-list-toolbar [] [toolbar {:nav-action {:image {:source {:uri :icon_hamburger} :style st/hamburger-icon} - :handler (fn [])} + :handler open-drawer} :title "Chats" :action {:image {:source {:uri :icon_search} :style st/search-icon} @@ -29,22 +30,23 @@ (defn chats-list [] (let [chats (subscribe [:get :chats])] (fn [] - [view st/chats-container - [chats-list-toolbar] - [list-view {:dataSource (to-datasource (vals @chats)) - :renderRow (fn [row _ _] - (list-item [chat-list-item row])) - :style st/list-container}] - [action-button {:buttonColor color-blue} - [action-button-item - {:title "New Chat" - :buttonColor :#9b59b6 - :onPress #(dispatch [:navigate-to :contact-list])} - [icon {:name :android-create - :style st/create-icon}]] - [action-button-item - {:title "New Group Chat" - :buttonColor :#1abc9c - :onPress #(dispatch [:show-group-new])} - [icon {:name :person-stalker - :style st/person-stalker-icon}]]]]))) + [drawer-view + [view st/chats-container + [chats-list-toolbar] + [list-view {:dataSource (to-datasource (vals @chats)) + :renderRow (fn [row _ _] + (list-item [chat-list-item row])) + :style st/list-container}] + [action-button {:buttonColor color-blue} + [action-button-item + {:title "New Chat" + :buttonColor :#9b59b6 + :onPress #(dispatch [:navigate-to :contact-list])} + [icon {:name :android-create + :style st/create-icon}]] + [action-button-item + {:title "New Group Chat" + :buttonColor :#1abc9c + :onPress #(dispatch [:show-group-new])} + [icon {:name :person-stalker + :style st/person-stalker-icon}]]]]]))) diff --git a/src/syng_im/components/drawer.cljs b/src/syng_im/components/drawer.cljs index 9716333b54..74d38d8f4e 100644 --- a/src/syng_im/components/drawer.cljs +++ b/src/syng_im/components/drawer.cljs @@ -35,9 +35,9 @@ [text {:style st/menu-item-text} name]]) -(defn drawer-menu [navigator] +(defn drawer-menu [] (let [username (subscribe [:get :username])] - (fn [navigator] + (fn [] [view st/drawer-menu [view st/user-photo-container [user-photo {}]] @@ -72,10 +72,10 @@ [text {:style st/switch-users-text} "Switch users"]]]]))) -(defn drawer-view [{:keys [navigator]} items] +(defn drawer-view [items] [drawer-layout-android {:drawerWidth 260 :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] (reset! drawer-atom drawer))} items])