Skip to content

Commit

Permalink
Navigation cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferossgp committed Feb 26, 2020
1 parent 935e55a commit d517ae4
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 44 deletions.
15 changes: 7 additions & 8 deletions src/status_im/ens/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@
;; we reset navigation so that navigate back doesn't return
;; into the registration flow
(navigation/navigate-reset cofx
{:index 1
:key :profile-stack
:actions [{:routeName :my-profile}
{:routeName :ens-confirmation}]}))
{:index 1
:key :profile-stack
:routes [{:name :my-profile}
{:name :ens-confirmation}]}))

(defn- on-resolve-owner
[registry custom-domain? username address public-key response resolve-last-id* resolve-last-id]
Expand Down Expand Up @@ -219,10 +219,9 @@
{:db (dissoc db :ens/registration)}
;; we reset navigation so that navigate back doesn't return
;; into the registration flow
(navigation/navigate-reset {:index 1
:key :profile-stack
:actions [{:routeName :my-profile}
{:routeName :ens-main}]})))
(navigation/navigate-reset {:index 1
:routes [{:name :my-profile}
{:name :ens-main}]})))

(fx/defn switch-domain-type
{:events [::switch-domain-type]}
Expand Down
1 change: 0 additions & 1 deletion src/status_im/multiaccounts/login/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@
(when save-password?
(keychain/save-user-password key-uid password))
(keychain/save-auth-method key-uid (or new-auth-method auth-method))
(navigation/navigate-to-cofx :home nil)
(when platform/desktop?
(chat-model/update-dock-badge-label)))))

Expand Down
6 changes: 3 additions & 3 deletions src/status_im/qr_scanner/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
:on-allowed #(re-frame/dispatch [:navigate-to :qr-scanner opts])
:on-denied (fn []
(utils/set-timeout
#(utils/show-popup (i18n/label :t/error)
(i18n/label :t/camera-access-error))
50))}})
#(utils/show-popup (i18n/label :t/error)
(i18n/label :t/camera-access-error))
50))}})

(fx/defn set-qr-code
[{:keys [db]} opts data]
Expand Down
50 changes: 25 additions & 25 deletions src/status_im/ui/components/tabbar/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
(when (not= to @last-to-value)
(reset! last-to-value to)
(animation/start
(animation/timing visible
{:toValue to
:duration duration
:easing (animation/cubic)
:useNativeDriver true})
(animation/timing visible
{:toValue to
:duration duration
:easing (animation/cubic)
:useNativeDriver true})
callback))))

(defn main-tab? [view-id]
Expand Down Expand Up @@ -114,27 +114,27 @@
:reagent-render
(fn [{:keys [navigate index inset]}]
(when-not @keyboard-shown?
[react/animated-view {:style (tabs.styles/tabs-wrapper @minimized-state inset)}
[react/animated-view {:style (tabs.styles/animated-container visible?)}
[react/view
{:style tabs.styles/tabs-container}
[react/view {:style tabs.styles/tabs}
(for [[route-index
{:keys [nav-stack accessibility-label count-subscription content]}]
tabs-list-data
[react/animated-view {:style (tabs.styles/tabs-wrapper @minimized-state inset)}
[react/animated-view {:style (tabs.styles/animated-container visible?)}
[react/view
{:style tabs.styles/tabs-container}
[react/view {:style tabs.styles/tabs}
(for [[route-index
{:keys [nav-stack accessibility-label count-subscription content]}]
tabs-list-data

:let [{:keys [icon title]} content]]
^{:key nav-stack}
[tab
{:icon icon
:label title
:on-press #(navigate (name nav-stack))
:accessibility-label accessibility-label
:count-subscription count-subscription
:active? (= (str index) (str route-index))
:nav-stack nav-stack}])]]]
[react/view
{:style (tabs.styles/ios-titles-cover inset)}]]))})))
:let [{:keys [icon title]} content]]
^{:key nav-stack}
[tab
{:icon icon
:label title
:on-press #(navigate (name nav-stack))
:accessibility-label accessibility-label
:count-subscription count-subscription
:active? (= (str index) (str route-index))
:nav-stack nav-stack}])]]]
[react/view
{:style (tabs.styles/ios-titles-cover inset)}]]))})))

(defn tabbar [props]
(let [navigate (oget props "navigation" "navigate")
Expand Down
10 changes: 5 additions & 5 deletions src/status_im/ui/screens/ens/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
[status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.screens.chat.message.message :as message]
[status-im.ui.screens.profile.components.views :as profile.components]
[status-im.utils.navigation :as navigation]
[status-im.ui.components.list-item.views :as list-item]
[status-im.ui.screens.chat.photos :as photos]
[status-im.multiaccounts.core :as multiaccounts]
Expand Down Expand Up @@ -186,10 +185,11 @@
[react/view {:flex-direction :row :justify-content :center}
;;NOTE required so that the keyboards shows up when navigating
;;back from checkout screen
[:> navigation/navigation-events
{:on-did-focus
(fn []
(.focus @input-ref))}]
;; TODO: navigation-events were deprecated
;; [:> navigation/navigation-events
;; {:on-did-focus
;; (fn []
;; (.focus @input-ref))}]
;;NOTE setting the key as placeholder forces the component to remount
;;when the placeholder changes, this prevents the placeholder from
;;disappearing when switching between stateofus and custom domain
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/ui/screens/routing/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@
(when (can-be-called?)
(ocall @navigator-ref "dispatch"
(ocall stack-actions "replace"
#js {:routeName (name route)
:params (clj->js params)}))))
#js {:name (name route)
:params (clj->js params)}))))

0 comments on commit d517ae4

Please sign in to comment.