diff --git a/src/js/worklets/shell.js b/src/js/worklets/shell.js index 5d0fb06baf..7e76ad7a6b 100644 --- a/src/js/worklets/shell.js +++ b/src/js/worklets/shell.js @@ -18,11 +18,11 @@ export function stackOpacity (stackId, selectedStackId) { ); } -export function stackPointer (stackId, selectedStackId) { +export function stackZIndex (stackId, selectedStackId) { return useDerivedValue( function () { 'worklet' - return selectedStackId.value == stackId ? "auto" : "none"; + return selectedStackId.value == stackId ? 10 : 9; } ); } diff --git a/src/status_im2/contexts/shell/animation.cljs b/src/status_im2/contexts/shell/animation.cljs index 1d5980ccc4..672fe2dde1 100644 --- a/src/status_im2/contexts/shell/animation.cljs +++ b/src/status_im2/contexts/shell/animation.cljs @@ -93,13 +93,13 @@ (fn [acc id] (let [tabs-icon-color-keyword (get shell.constants/tabs-icon-color-keywords id) stack-opacity-keyword (get shell.constants/stacks-opacity-keywords id) - stack-pointer-keyword (get shell.constants/stacks-pointer-keywords id)] + stack-z-index-keyword (get shell.constants/stacks-z-index-keywords id)] (assoc acc stack-opacity-keyword (worklets.shell/stack-opacity (name id) selected-stack-id-sv) - stack-pointer-keyword - (worklets.shell/stack-pointer (name id) selected-stack-id-sv) + stack-z-index-keyword + (worklets.shell/stack-z-index (name id) selected-stack-id-sv) tabs-icon-color-keyword (worklets.shell/bottom-tab-icon-color (name id) diff --git a/src/status_im2/contexts/shell/constants.cljs b/src/status_im2/contexts/shell/constants.cljs index 0dfeab91f4..e76b94304c 100644 --- a/src/status_im2/contexts/shell/constants.cljs +++ b/src/status_im2/contexts/shell/constants.cljs @@ -36,18 +36,18 @@ :wallet-stack :wallet-stack-opacity :browser-stack :browser-stack-opacity}) -(def stacks-pointer-keywords - {:communities-stack :communities-stack-pointer - :chats-stack :chats-stack-pointer - :wallet-stack :wallet-stack-pointer - :browser-stack :browser-stack-pointer}) - (def tabs-icon-color-keywords {:communities-stack :communities-tab-icon-color :chats-stack :chats-tab-icon-opacity :wallet-stack :wallet-tab-icon-opacity :browser-stack :browser-tab-icon-opacity}) +(def stacks-z-index-keywords + {:communities-stack :communities-stack-z-index + :chats-stack :chats-stack-z-index + :wallet-stack :wallet-stack-z-index + :browser-stack :browser-stack-z-index}) + ;; Home stack states (def ^:const close-with-animation 0) diff --git a/src/status_im2/contexts/shell/home_stack.cljs b/src/status_im2/contexts/shell/home_stack.cljs index ff14d4bcd4..0bbe620ada 100644 --- a/src/status_im2/contexts/shell/home_stack.cljs +++ b/src/status_im2/contexts/shell/home_stack.cljs @@ -18,14 +18,12 @@ (defn- f-stack-view [stack-id shared-values] - ;; TODO lazy loading doesn't work with functional components with hoocks (when (load-stack? stack-id)) - ;; Error: Rendered more hooks than during the previous render. [reanimated/view {:style (reanimated/apply-animations-to-style - {:opacity (get shared-values - (get shell.constants/stacks-opacity-keywords stack-id)) - :pointer-events (get shared-values - (get shell.constants/stacks-pointer-keywords stack-id))} + {:opacity (get shared-values + (get shell.constants/stacks-opacity-keywords stack-id)) + :z-index (get shared-values + (get shell.constants/stacks-z-index-keywords stack-id))} {:position :absolute :top 0 :bottom 0 @@ -38,6 +36,11 @@ :wallet-stack [wallet.accounts/accounts-overview] :browser-stack [browser.stack/browser-stack])]) +(defn lazy-screen + [stack-id shared-values] + (when (load-stack? stack-id) + [:f> f-stack-view stack-id shared-values])) + (defn f-home-stack [] (let [shared-values @animation/shared-values-atom @@ -50,7 +53,7 @@ :transform [{:scale (:home-stack-scale shared-values)}]} home-stack-original-style)] [reanimated/view {:style home-stack-animated-style} - [:f> f-stack-view :communities-stack shared-values] - [:f> f-stack-view :chats-stack shared-values] - [:f> f-stack-view :browser-stack shared-values] - [:f> f-stack-view :wallet-stack shared-values]])) + [lazy-screen :communities-stack shared-values] + [lazy-screen :chats-stack shared-values] + [lazy-screen :browser-stack shared-values] + [lazy-screen :wallet-stack shared-values]])) diff --git a/src/utils/worklets/shell.cljs b/src/utils/worklets/shell.cljs index 29a46e1588..c881d4b8d9 100644 --- a/src/utils/worklets/shell.cljs +++ b/src/utils/worklets/shell.cljs @@ -6,9 +6,9 @@ [id selected-stack-id] (.stackOpacity ^js shell-worklets id selected-stack-id)) -(defn stack-pointer +(defn stack-z-index [id selected-stack-id] - (.stackPointer ^js shell-worklets id selected-stack-id)) + (.stackZIndex ^js shell-worklets id selected-stack-id)) (defn bottom-tabs-height [home-stack-state-sv container-height extended-container-height]