From ee7de392749f9900202b9955156c300d96c1646b Mon Sep 17 00:00:00 2001 From: virvar Date: Tue, 10 May 2016 10:59:38 +0300 Subject: [PATCH] Fix navigation. Change image to icon. --- src/syng_im/components/chat.cljs | 2 +- src/syng_im/components/chats/chats_list.cljs | 2 +- src/syng_im/components/profile.cljs | 25 ++++++++------------ src/syng_im/components/toolbar.cljs | 5 ++-- src/syng_im/handlers.cljs | 4 ++-- 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/syng_im/components/chat.cljs b/src/syng_im/components/chat.cljs index 9b9ad18ae8..be4217e57e 100644 --- a/src/syng_im/components/chat.cljs +++ b/src/syng_im/components/chat.cljs @@ -125,7 +125,7 @@ :height 13} :handler (fn [])}] [{:title "Profile" - :icon "icon_menu_group" + :icon :menu_group :icon-style {:width 25 :height 19} :handler #(dispatch [:show-profile @chat-id])}])] diff --git a/src/syng_im/components/chats/chats_list.cljs b/src/syng_im/components/chats/chats_list.cljs index d62227e8c0..2b63d8d76f 100644 --- a/src/syng_im/components/chats/chats_list.cljs +++ b/src/syng_im/components/chats/chats_list.cljs @@ -64,7 +64,7 @@ [action-button-item {:title "New Group Chat" :buttonColor "#1abc9c" :onPress (fn [] - (dispatch [:show-group-new navigator]))} + (dispatch [:show-group-new]))} [icon {:name "person-stalker" :style {:fontSize 20 :height 22 diff --git a/src/syng_im/components/profile.cljs b/src/syng_im/components/profile.cljs index d6fd8505e9..e5dcfa2b61 100644 --- a/src/syng_im/components/profile.cljs +++ b/src/syng_im/components/profile.cljs @@ -6,13 +6,12 @@ text text-input image + icon scroll-view - navigator touchable-highlight touchable-opacity]] [syng-im.resources :as res] - [syng-im.components.profile-styles :as st] - [syng-im.navigation :refer [nav-pop]])) + [syng-im.components.profile-styles :as st])) (defn user-photo [{:keys [photo-path]}] [image {:source (if (s/blank? photo-path) @@ -34,21 +33,19 @@ [text {:style st/profile-property-view-value} value]]]) -(defn message-user [navigator identity] +(defn message-user [identity] (when identity - (dispatch [:show-chat identity navigator :push]))) + (dispatch [:show-chat identity nil :push]))) -(defn profile [{:keys [navigator]}] +(defn profile [] (let [contact (subscribe [:contact])] - (fn [{:keys [navigator]}] + (fn [] [scroll-view {:style st/profile} [touchable-highlight {:style st/profile-back-button-touchable - :on-press (fn [] - (nav-pop navigator)) + :on-press #(dispatch [:navigate-back]) :underlay-color :transparent} [view st/profile-back-button-container - [image {:source {:uri "icon_back"} - :style st/profile-back-button-icon}]]] + [icon :back st/profile-back-button-icon]]] [view st/status-block [view st/user-photo-container [user-photo {}] @@ -58,8 +55,7 @@ [text {:style st/status} "!not implemented"] [view st/btns-container - [touchable-highlight {:onPress #(message-user navigator - (:whisper-identity @contact)) + [touchable-highlight {:onPress #(message-user (:whisper-identity @contact)) :underlay-color :transparent} [view st/message-btn [text {:style st/message-btn-text} @@ -69,8 +65,7 @@ ) :underlay-color :transparent} [view st/more-btn - [image {:source {:uri "icon_more_vertical_blue"} - :style st/more-btn-image}]]]]] + [icon :more_vertical_blue st/more-btn-image]]]]] [view st/profile-properties-container [profile-property-view {:name "Username" :value (:name @contact)}] diff --git a/src/syng_im/components/toolbar.cljs b/src/syng_im/components/toolbar.cljs index ad34b23efe..6cfbb96af4 100644 --- a/src/syng_im/components/toolbar.cljs +++ b/src/syng_im/components/toolbar.cljs @@ -15,8 +15,7 @@ toolbar-background1]] [syng-im.components.realm :refer [list-view]] [syng-im.utils.listview :refer [to-realm-datasource]] - [reagent.core :as r] - [syng-im.navigation :refer [nav-pop]])) + [reagent.core :as r])) (defn toolbar [{:keys [navigator title nav-action action background-color]}] [view {:style {:flexDirection "row" @@ -30,7 +29,7 @@ :alignItems "center" :justifyContent "center"} [image (:image nav-action)]]] - [touchable-highlight {:on-press #(nav-pop navigator)} + [touchable-highlight {:on-press #(dispatch [:navigate-back])} [view {:width 56 :height 56} [image {:source {:uri "icon_back"} diff --git a/src/syng_im/handlers.cljs b/src/syng_im/handlers.cljs index 5cf4db5609..5e8611f4be 100644 --- a/src/syng_im/handlers.cljs +++ b/src/syng_im/handlers.cljs @@ -561,9 +561,9 @@ db))) (register-handler :show-group-new - (fn [db [action navigator]] + (fn [db [action]] (log/debug action) - (nav-push navigator {:view-id :new-group}) + (dispatch [:navigate-to :new-group]) (clear-new-group db))) (register-handler :select-for-new-group