|
41 | 41 | (when (ff/enabled? ::ff/wallet.home-activity)
|
42 | 42 | {:id :activity :label (i18n/label :t/activity) :accessibility-label :activity-tab})])
|
43 | 43 |
|
| 44 | +(defn- change-tab [id] (rf/dispatch [:wallet/select-home-tab id])) |
| 45 | + |
44 | 46 | (defn- render-cards
|
45 | 47 | [cards ref]
|
46 | 48 | [rn/flat-list
|
|
64 | 66 |
|
65 | 67 | (defn view
|
66 | 68 | []
|
67 |
| - (let [[selected-tab set-selected-tab] (rn/use-state (:id (first tabs-data))) |
68 |
| - account-list-ref (rn/use-ref-atom nil) |
69 |
| - tokens-loading? (rf/sub [:wallet/home-tokens-loading?]) |
70 |
| - networks (rf/sub [:wallet/selected-network-details]) |
71 |
| - account-cards-data (rf/sub [:wallet/account-cards-data]) |
72 |
| - cards (conj account-cards-data (new-account-card-data)) |
73 |
| - [init-loaded? set-init-loaded] (rn/use-state false) |
74 |
| - {:keys [formatted-balance]} (rf/sub [:wallet/aggregated-token-values-and-balance]) |
75 |
| - theme (quo.theme/use-theme)] |
| 69 | + (let [selected-tab (rf/sub [:wallet/home-tab]) |
| 70 | + account-list-ref (rn/use-ref-atom nil) |
| 71 | + tokens-loading? (rf/sub [:wallet/home-tokens-loading?]) |
| 72 | + networks (rf/sub [:wallet/selected-network-details]) |
| 73 | + account-cards-data (rf/sub [:wallet/account-cards-data]) |
| 74 | + cards (conj account-cards-data (new-account-card-data)) |
| 75 | + [init-loaded? set-init-loaded] (rn/use-state false) |
| 76 | + {:keys [formatted-balance]} (rf/sub [:wallet/aggregated-token-values-and-balance]) |
| 77 | + theme (quo.theme/use-theme)] |
76 | 78 | (rn/use-effect (fn []
|
77 | 79 | (when (and @account-list-ref (pos? (count cards)))
|
78 | 80 | (.scrollToOffset ^js @account-list-ref
|
|
104 | 106 | (when (ff/enabled? ::ff/wallet.graph)
|
105 | 107 | [quo/wallet-graph {:time-frame :empty}])
|
106 | 108 | [render-cards cards account-list-ref]
|
107 |
| - [render-tabs tabs-data set-selected-tab selected-tab]] |
| 109 | + [render-tabs tabs-data change-tab selected-tab]] |
108 | 110 | :content-container-style style/list-container
|
109 | 111 | :sticky-header-indices [0]
|
110 | 112 | :data []
|
|
0 commit comments