[#21615] fix: hide tabs if there is no recurrent data
This commit is contained in:
parent
dadb10bf37
commit
47777132bd
|
@ -49,6 +49,7 @@
|
|||
(rf/dispatch [:wallet/get-crypto-on-ramps])))
|
||||
(let [crypto-on-ramps (rf/sub [:wallet/crypto-on-ramps])
|
||||
account (rf/sub [:wallet/current-viewing-account-or-default])
|
||||
has-recurrent? (seq (:recurrent crypto-on-ramps))
|
||||
[selected-tab set-selected-tab] (rn/use-state initial-tab)
|
||||
[min-height set-min-height] (rn/use-state 0)
|
||||
on-layout (rn/use-callback
|
||||
|
@ -56,18 +57,27 @@
|
|||
(oops/oget % :nativeEvent :layout :height)))]
|
||||
[:<>
|
||||
[quo/drawer-top {:title (or title (i18n/label :t/ways-to-buy-assets))}]
|
||||
[quo/segmented-control
|
||||
{:size 32
|
||||
:container-style style/tabs
|
||||
:default-active initial-tab
|
||||
:on-change set-selected-tab
|
||||
:data tabs}]
|
||||
[rn/flat-list
|
||||
{:data (if (= selected-tab :recurrent)
|
||||
(:recurrent crypto-on-ramps)
|
||||
(:one-time crypto-on-ramps))
|
||||
:on-layout on-layout
|
||||
:style (style/list-container min-height)
|
||||
:render-data {:tab selected-tab
|
||||
:account account}
|
||||
:render-fn crypto-on-ramp-item}]]))
|
||||
(when has-recurrent?
|
||||
[:<>
|
||||
[quo/segmented-control
|
||||
{:size 32
|
||||
:container-style style/tabs
|
||||
:default-active initial-tab
|
||||
:on-change set-selected-tab
|
||||
:data tabs}]
|
||||
[rn/flat-list
|
||||
{:data (if (= selected-tab :recurrent)
|
||||
(:recurrent crypto-on-ramps)
|
||||
(:one-time crypto-on-ramps))
|
||||
:on-layout on-layout
|
||||
:style (style/list-container min-height)
|
||||
:render-data {:tab selected-tab
|
||||
:account account}
|
||||
:render-fn crypto-on-ramp-item}]])
|
||||
(when-not has-recurrent?
|
||||
[rn/flat-list
|
||||
{:data (:one-time crypto-on-ramps)
|
||||
:on-layout on-layout
|
||||
:style (style/list-container min-height)
|
||||
:render-data {:account account}
|
||||
:render-fn crypto-on-ramp-item}])]))
|
||||
|
|
Loading…
Reference in New Issue