navigate to home when press chat tab on chat screen

This commit is contained in:
andrey 2020-10-30 07:17:38 +01:00
parent d380186051
commit b7948b9869
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
1 changed files with 18 additions and 14 deletions

View File

@ -75,16 +75,16 @@
(def tabs (def tabs
(reagent/adapt-react-class (reagent/adapt-react-class
(fn [props] (fn [props]
(let [{:keys [navigate index route state]} (bean props) (let [{:keys [navigate index route state popToTop]} (bean props)
{:keys [keyboard-shown] {:keys [keyboard-shown]
:or {keyboard-shown false}} (when platform/android? (rn/use-keyboard)) :or {keyboard-shown false}} (when platform/android? (rn/use-keyboard))
{:keys [bottom]} (safe-area/use-safe-area) {:keys [bottom]} (safe-area/use-safe-area)
animated-visible (animated/use-timing-transition animated-visible (animated/use-timing-transition
(main-tab? (keyword route)) (main-tab? (keyword route))
{:duration 150}) {:duration 150})
keyboard-visible (animated/use-timing-transition keyboard-visible (animated/use-timing-transition
keyboard-shown keyboard-shown
{:duration 200})] {:duration 200})]
(reagent/as-element (reagent/as-element
[animated/view {:style (tabs.styles/tabs-wrapper keyboard-shown keyboard-visible) [animated/view {:style (tabs.styles/tabs-wrapper keyboard-shown keyboard-visible)
:pointer-events (if keyboard-shown "none" "auto")} :pointer-events (if keyboard-shown "none" "auto")}
@ -99,10 +99,12 @@
[tab [tab
{:icon icon {:icon icon
:label title :label title
:on-press #(let [view-id (navigation/get-index-route-name route-index (bean state))] :on-press #(if (= (str index) (str route-index))
(re-frame/dispatch-sync [:screens/tab-will-change view-id]) (popToTop)
(reagent/flush) (let [view-id (navigation/get-index-route-name route-index (bean state))]
(navigate (name nav-stack))) (re-frame/dispatch-sync [:screens/tab-will-change view-id])
(reagent/flush)
(navigate (name nav-stack))))
:accessibility-label accessibility-label :accessibility-label accessibility-label
:count-subscription count-subscription :count-subscription count-subscription
:active? (= (str index) (str route-index)) :active? (= (str index) (str route-index))
@ -112,10 +114,12 @@
(defn tabbar [props] (defn tabbar [props]
(let [navigate (oget props "navigation" "navigate") (let [navigate (oget props "navigation" "navigate")
state (bean (oget props "state")) pop-to-top (oget props "navigation" "popToTop")
index (get state :index)] state (bean (oget props "state"))
index (get state :index)]
(reagent/as-element (reagent/as-element
[tabs {:navigate navigate [tabs {:navigate navigate
:state (oget props "state") :state (oget props "state")
:popToTop pop-to-top
:route (navigation/get-active-route-name state) :route (navigation/get-active-route-name state)
:index index}]))) :index index}])))