fix: back button on 1:1 chat (#17544)

* fix: back button on 1:1 chat

* fix: show close icon only for 1:1 and community chat

* fix: use close icon for only 1:1 chat
This commit is contained in:
BalogunofAfrica 2023-10-06 12:47:29 +01:00 committed by GitHub
parent afbd890a04
commit b88dcf1072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -15,7 +15,8 @@
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn f-view (defn f-view
[{:keys [theme scroll-y chat chat-screen-loaded? all-loaded? display-name online? photo-path]}] [{:keys [theme scroll-y chat chat-screen-loaded? all-loaded? display-name online? photo-path
back-icon]}]
(let [{:keys [group-chat chat-id]} chat (let [{:keys [group-chat chat-id]} chat
opacity-animation (reanimated/interpolate scroll-y opacity-animation (reanimated/interpolate scroll-y
[style/navigation-bar-height [style/navigation-bar-height
@ -63,7 +64,7 @@
(when config/shell-navigation-disabled? (when config/shell-navigation-disabled?
(rf/dispatch [:chat/close])) (rf/dispatch [:chat/close]))
(rf/dispatch [:navigate-back]))} (rf/dispatch [:navigate-back]))}
:i/arrow-left] back-icon]
[reanimated/view [reanimated/view
{:style (style/animated-header all-loaded? translate-animation title-opacity-animation)} {:style (style/animated-header all-loaded? translate-animation title-opacity-animation)}
[rn/view {:style style/header-content-container} [rn/view {:style style/header-content-container}

View File

@ -39,7 +39,10 @@
(str (when emoji (str emoji " ")) "# " chat-name) (str (when emoji (str emoji " ")) "# " chat-name)
:else (str emoji chat-name)) :else (str emoji chat-name))
online? (rf/sub [:visibility-status-updates/online? chat-id]) online? (rf/sub [:visibility-status-updates/online? chat-id])
photo-path (rf/sub [:chats/photo-path chat-id])] photo-path (rf/sub [:chats/photo-path chat-id])
back-icon (if (= chat-type constants/one-to-one-chat-type)
:i/close
:i/arrow-left)]
(rn/use-effect (rn/use-effect
(fn [] (fn []
;; If keyboard is shown then adjust `scroll-y` ;; If keyboard is shown then adjust `scroll-y`
@ -71,6 +74,7 @@
[messages.navigation/navigation-view [messages.navigation/navigation-view
{:scroll-y scroll-y {:scroll-y scroll-y
:back-icon back-icon
:chat chat :chat chat
:chat-screen-loaded? chat-screen-loaded? :chat-screen-loaded? chat-screen-loaded?
:all-loaded? all-loaded? :all-loaded? all-loaded?