fix navigation reset
currently navigation-reset only works properly if you reset to a simple route this fix allows us to use navigation reset with more complex routes, by ensuring that the navigation stack is populated properly so that navigate back doesn't end up emptying the stack. this is temporary as the proper way to do navigation in general would be to get rid of view id and navigation-stack entirely, since it is a duplication of the state of react-navigation Signed-off-by: yenda <eric@status.im>
This commit is contained in:
parent
1314c6e7d7
commit
500d2cc787
|
@ -49,9 +49,13 @@
|
||||||
|
|
||||||
(fx/defn navigate-reset
|
(fx/defn navigate-reset
|
||||||
[{:keys [db]} {:keys [index actions] :as config}]
|
[{:keys [db]} {:keys [index actions] :as config}]
|
||||||
(let [view-id (:routeName (get actions index))]
|
(let [stack (into '() (map :routeName actions))
|
||||||
{:db (assoc db :view-id view-id
|
view-id (get stack index)]
|
||||||
:navigation-stack (list view-id))
|
{:db (assoc db
|
||||||
|
:view-id view-id
|
||||||
|
;;NOTE: stricly needs to be a list
|
||||||
|
;;because navigate-back pops it
|
||||||
|
:navigation-stack stack)
|
||||||
::navigate-reset config}))
|
::navigate-reset config}))
|
||||||
|
|
||||||
(def unload-data-interceptor
|
(def unload-data-interceptor
|
||||||
|
@ -158,7 +162,7 @@
|
||||||
(fn []
|
(fn []
|
||||||
(reset! processing-back-event? false)))
|
(reset! processing-back-event? false)))
|
||||||
|
|
||||||
;; Below two effects are added when we need
|
;; Below two effects are added when we need
|
||||||
;; to override default react-navigation's BACK action
|
;; to override default react-navigation's BACK action
|
||||||
;; processing
|
;; processing
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
|
|
Loading…
Reference in New Issue