fix: select asset screen render function (#20086)

fix: select asset screen render function (#20086)
This commit is contained in:
Omar Basem 2024-05-17 21:59:13 +04:00 committed by GitHub
parent 47428368fd
commit 9d302d8192
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 26 additions and 28 deletions

View File

@ -3,7 +3,6 @@
[clojure.string :as string] [clojure.string :as string]
[quo.core :as quo] [quo.core :as quo]
[react-native.core :as rn] [react-native.core :as rn]
[reagent.core :as reagent]
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher] [status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
[status-im.contexts.wallet.common.asset-list.view :as asset-list] [status-im.contexts.wallet.common.asset-list.view :as asset-list]
[status-im.contexts.wallet.common.collectibles-tab.view :as collectibles-tab] [status-im.contexts.wallet.common.collectibles-tab.view :as collectibles-tab]
@ -59,33 +58,32 @@
(defn view (defn view
[] []
(let [selected-tab (reagent/atom (:id (first tabs-data))) (let [[selected-tab set-selected-tab] (rn/use-state (:id (first tabs-data)))
search-text (reagent/atom "") [search-text set-search-text] (rn/use-state "")
on-change-text #(reset! search-text %) on-change-text #(set-search-text %)
on-change-tab #(reset! selected-tab %) on-change-tab #(set-selected-tab %)
on-close (fn [] on-close (fn []
(rf/dispatch [:wallet/clean-selected-token]) (rf/dispatch [:wallet/clean-selected-token])
(rf/dispatch [:wallet/clean-selected-collectible]) (rf/dispatch [:wallet/clean-selected-collectible])
(rf/dispatch [:navigate-back]))] (rf/dispatch [:navigate-back]))]
(rn/use-unmount (fn [] (rn/use-unmount (fn []
(rf/dispatch [:wallet/clean-selected-token]) (rf/dispatch [:wallet/clean-selected-token])
(rf/dispatch [:wallet/clean-selected-collectible]))) (rf/dispatch [:wallet/clean-selected-collectible])))
(fn [] [rn/safe-area-view {:style style/container}
[rn/safe-area-view {:style style/container} [account-switcher/view
[account-switcher/view {:icon-name :i/arrow-left
{:icon-name :i/arrow-left :on-press on-close
:on-press on-close :switcher-type :select-account}]
:switcher-type :select-account}] [quo/page-top
[quo/page-top {:title (i18n/label :t/select-asset)
{:title (i18n/label :t/select-asset) :title-accessibility-label :title-label}]
:title-accessibility-label :title-label}] [quo/segmented-control
[quo/segmented-control {:size 32
{:size 32 :blur? false
:blur? false :symbol false
:symbol false :default-active :tab/assets
:default-active :tab/assets :container-style {:margin-horizontal 20
:container-style {:margin-horizontal 20 :margin-vertical 8}
:margin-vertical 8} :data tabs-data
:data tabs-data :on-change on-change-tab}]
:on-change on-change-tab}] [tab-view search-text selected-tab on-change-text]]))
[tab-view @search-text @selected-tab on-change-text]])))