fix: Page Nav title animation (#19651)
This commit is contained in:
parent
22d63002b2
commit
bd5fb0d407
|
@ -13,13 +13,12 @@
|
||||||
:align-items :center})
|
:align-items :center})
|
||||||
|
|
||||||
(defn center-content-container
|
(defn center-content-container
|
||||||
[centered? center-opacity]
|
[centered?]
|
||||||
{:flex 1
|
{:flex 1
|
||||||
:margin-horizontal 12
|
:margin-horizontal 12
|
||||||
:flex-direction :row
|
:flex-direction :row
|
||||||
:align-items :center
|
:align-items :center
|
||||||
:justify-content (if centered? :center :flex-start)
|
:justify-content (if centered? :center :flex-start)})
|
||||||
:opacity center-opacity})
|
|
||||||
|
|
||||||
(def right-actions-container
|
(def right-actions-container
|
||||||
{:flex-direction :row})
|
{:flex-direction :row})
|
||||||
|
|
|
@ -99,14 +99,13 @@
|
||||||
(def threshold (- header-height page-nav-height))
|
(def threshold (- header-height page-nav-height))
|
||||||
|
|
||||||
(defn- title-center
|
(defn- title-center
|
||||||
[{:keys [centered? title center-opacity scroll-y]}]
|
[{:keys [title scroll-y center-content-container-style]}]
|
||||||
(let [animated-style (when scroll-y
|
(let [animated-style (when scroll-y
|
||||||
(header-worklet/profile-header-animation scroll-y
|
(header-worklet/profile-header-animation scroll-y
|
||||||
threshold
|
threshold
|
||||||
page-nav-height))]
|
page-nav-height))]
|
||||||
[reanimated/view
|
[reanimated/view
|
||||||
{:style [(style/center-content-container centered? center-opacity)
|
{:style [center-content-container-style animated-style]}
|
||||||
animated-style]}
|
|
||||||
[text/text
|
[text/text
|
||||||
{:weight :medium
|
{:weight :medium
|
||||||
:size :paragraph-1
|
:size :paragraph-1
|
||||||
|
@ -114,14 +113,15 @@
|
||||||
title]]))
|
title]]))
|
||||||
|
|
||||||
(defn- dropdown-center
|
(defn- dropdown-center
|
||||||
[{:keys [background dropdown-on-press dropdown-selected? dropdown-text center-opacity]}]
|
[{:keys [background dropdown-on-press dropdown-selected? dropdown-text
|
||||||
|
center-content-container-style]}]
|
||||||
(let [theme (quo.theme/use-theme)
|
(let [theme (quo.theme/use-theme)
|
||||||
dropdown-type (cond
|
dropdown-type (cond
|
||||||
(= background :photo) :grey
|
(= background :photo) :grey
|
||||||
(and (= theme :dark) (= background :blur)) :grey
|
(and (= theme :dark) (= background :blur)) :grey
|
||||||
:else :ghost)
|
:else :ghost)
|
||||||
dropdown-state (if dropdown-selected? :active :default)]
|
dropdown-state (if dropdown-selected? :active :default)]
|
||||||
[reanimated/view {:style (style/center-content-container true center-opacity)}
|
[reanimated/view {:style center-content-container-style}
|
||||||
[dropdown/view
|
[dropdown/view
|
||||||
{:type dropdown-type
|
{:type dropdown-type
|
||||||
:state dropdown-state
|
:state dropdown-state
|
||||||
|
@ -131,9 +131,9 @@
|
||||||
dropdown-text]]))
|
dropdown-text]]))
|
||||||
|
|
||||||
(defn- token-center
|
(defn- token-center
|
||||||
[{:keys [background token-logo token-name token-abbreviation center-opacity]}]
|
[{:keys [background token-logo token-name token-abbreviation center-content-container-style]}]
|
||||||
(let [theme (quo.theme/use-theme)]
|
(let [theme (quo.theme/use-theme)]
|
||||||
[reanimated/view {:style (style/center-content-container false center-opacity)}
|
[reanimated/view {:style center-content-container-style}
|
||||||
[rn/image {:style style/token-logo :source token-logo}]
|
[rn/image {:style style/token-logo :source token-logo}]
|
||||||
[text/text
|
[text/text
|
||||||
{:style style/token-name
|
{:style style/token-name
|
||||||
|
@ -149,9 +149,9 @@
|
||||||
token-abbreviation]]))
|
token-abbreviation]]))
|
||||||
|
|
||||||
(defn- channel-center
|
(defn- channel-center
|
||||||
[{:keys [background channel-emoji channel-name channel-icon center-opacity]}]
|
[{:keys [background channel-emoji channel-name channel-icon center-content-container-style]}]
|
||||||
(let [theme (quo.theme/use-theme)]
|
(let [theme (quo.theme/use-theme)]
|
||||||
[reanimated/view {:style (style/center-content-container false center-opacity)}
|
[reanimated/view {:style center-content-container-style}
|
||||||
[rn/text {:style style/channel-emoji}
|
[rn/text {:style style/channel-emoji}
|
||||||
channel-emoji]
|
channel-emoji]
|
||||||
[text/text
|
[text/text
|
||||||
|
@ -163,9 +163,9 @@
|
||||||
[icons/icon channel-icon {:size 16 :color (style/channel-icon-color theme background)}]]))
|
[icons/icon channel-icon {:size 16 :color (style/channel-icon-color theme background)}]]))
|
||||||
|
|
||||||
(defn- title-description-center
|
(defn- title-description-center
|
||||||
[{:keys [background picture title description center-opacity]}]
|
[{:keys [background picture title description center-content-container-style]}]
|
||||||
(let [theme (quo.theme/use-theme)]
|
(let [theme (quo.theme/use-theme)]
|
||||||
[reanimated/view {:style (style/center-content-container false center-opacity)}
|
[reanimated/view {:style center-content-container-style}
|
||||||
(when picture
|
(when picture
|
||||||
[rn/view {:style style/group-avatar-picture}
|
[rn/view {:style style/group-avatar-picture}
|
||||||
[group-avatar/view {:picture picture :size :size-28}]])
|
[group-avatar/view {:picture picture :size :size-28}]])
|
||||||
|
@ -184,11 +184,11 @@
|
||||||
description]]]))
|
description]]]))
|
||||||
|
|
||||||
(defn- community-network-center
|
(defn- community-network-center
|
||||||
[{:keys [type community-logo network-logo community-name network-name center-opacity]}]
|
[{:keys [type community-logo network-logo community-name network-name center-content-container-style]}]
|
||||||
(let [community? (= type :community)
|
(let [community? (= type :community)
|
||||||
shown-logo (if community? community-logo network-logo)
|
shown-logo (if community? community-logo network-logo)
|
||||||
shown-name (if community? community-name network-name)]
|
shown-name (if community? community-name network-name)]
|
||||||
[reanimated/view {:style (style/center-content-container false center-opacity)}
|
[reanimated/view {:style center-content-container-style}
|
||||||
[rn/image
|
[rn/image
|
||||||
{:style style/community-network-logo
|
{:style style/community-network-logo
|
||||||
:source shown-logo}]
|
:source shown-logo}]
|
||||||
|
@ -199,8 +199,8 @@
|
||||||
shown-name]]))
|
shown-name]]))
|
||||||
|
|
||||||
(defn- wallet-networks-center
|
(defn- wallet-networks-center
|
||||||
[{:keys [networks networks-on-press background center-opacity]}]
|
[{:keys [networks networks-on-press background center-content-container-style]}]
|
||||||
[reanimated/view {:style (style/center-content-container true center-opacity)}
|
[reanimated/view {:style center-content-container-style}
|
||||||
[network-dropdown/view
|
[network-dropdown/view
|
||||||
{:state :default
|
{:state :default
|
||||||
:on-press networks-on-press
|
:on-press networks-on-press
|
||||||
|
@ -250,12 +250,21 @@
|
||||||
`:network`
|
`:network`
|
||||||
- network-name
|
- network-name
|
||||||
- network-logo a valid rn/image `:source` value"
|
- network-logo a valid rn/image `:source` value"
|
||||||
[{:keys [type right-side background text-align behind-overlay?]
|
[{:keys [type right-side background text-align behind-overlay? center-opacity]
|
||||||
:or {type :no-title
|
:or {type :no-title
|
||||||
text-align :center
|
text-align :center
|
||||||
right-side :none
|
right-side :none
|
||||||
background :white}
|
background :white}
|
||||||
:as props}]
|
:as props}]
|
||||||
|
(let [center-content-container-style (reanimated/apply-animations-to-style
|
||||||
|
(if center-opacity
|
||||||
|
{:opacity center-opacity}
|
||||||
|
nil)
|
||||||
|
(style/center-content-container
|
||||||
|
(and (= type :title) (= text-align :center))))
|
||||||
|
props-with-style (assoc props
|
||||||
|
:center-content-container-style
|
||||||
|
center-content-container-style)]
|
||||||
(case type
|
(case type
|
||||||
:no-title
|
:no-title
|
||||||
[page-nav-base props
|
[page-nav-base props
|
||||||
|
@ -268,7 +277,7 @@
|
||||||
:title
|
:title
|
||||||
(let [centered? (= text-align :center)]
|
(let [centered? (= text-align :center)]
|
||||||
[page-nav-base props
|
[page-nav-base props
|
||||||
[title-center (assoc props :centered? centered?)]
|
[title-center props-with-style]
|
||||||
[right-content
|
[right-content
|
||||||
{:background background
|
{:background background
|
||||||
:content right-side
|
:content right-side
|
||||||
|
@ -277,7 +286,7 @@
|
||||||
|
|
||||||
:dropdown
|
:dropdown
|
||||||
[page-nav-base props
|
[page-nav-base props
|
||||||
[dropdown-center props]
|
[dropdown-center props-with-style]
|
||||||
[right-content
|
[right-content
|
||||||
{:background background
|
{:background background
|
||||||
:content right-side
|
:content right-side
|
||||||
|
@ -286,7 +295,7 @@
|
||||||
|
|
||||||
:token
|
:token
|
||||||
[page-nav-base props
|
[page-nav-base props
|
||||||
[token-center props]
|
[token-center props-with-style]
|
||||||
[right-content
|
[right-content
|
||||||
{:background background
|
{:background background
|
||||||
:content right-side
|
:content right-side
|
||||||
|
@ -294,7 +303,7 @@
|
||||||
|
|
||||||
:channel
|
:channel
|
||||||
[page-nav-base props
|
[page-nav-base props
|
||||||
[channel-center props]
|
[channel-center props-with-style]
|
||||||
[right-content
|
[right-content
|
||||||
{:background background
|
{:background background
|
||||||
:content right-side
|
:content right-side
|
||||||
|
@ -303,7 +312,7 @@
|
||||||
|
|
||||||
:title-description
|
:title-description
|
||||||
[page-nav-base props
|
[page-nav-base props
|
||||||
[title-description-center props]
|
[title-description-center props-with-style]
|
||||||
[right-content
|
[right-content
|
||||||
{:background background
|
{:background background
|
||||||
:content right-side
|
:content right-side
|
||||||
|
@ -312,7 +321,7 @@
|
||||||
|
|
||||||
:wallet-networks
|
:wallet-networks
|
||||||
[page-nav-base props
|
[page-nav-base props
|
||||||
[wallet-networks-center props]
|
[wallet-networks-center props-with-style]
|
||||||
[right-content
|
[right-content
|
||||||
{:background background
|
{:background background
|
||||||
:content right-side
|
:content right-side
|
||||||
|
@ -321,11 +330,11 @@
|
||||||
|
|
||||||
(:community :network)
|
(:community :network)
|
||||||
[page-nav-base props
|
[page-nav-base props
|
||||||
[community-network-center props]
|
[community-network-center props-with-style]
|
||||||
[right-content
|
[right-content
|
||||||
{:background background
|
{:background background
|
||||||
:content right-side
|
:content right-side
|
||||||
:max-actions 3
|
:max-actions 3
|
||||||
:support-account-switcher? false}]]
|
:support-account-switcher? false}]]
|
||||||
|
|
||||||
nil))
|
nil)))
|
||||||
|
|
Loading…
Reference in New Issue