Commit 0c80dc9
authored
feat: Disable scroll from wallet tabs, enable wallet scroll (#22044)
## **Description**
This PR refactors the wallet page scroll architecture to improve
performance and user experience.
**What is the reason for the change?**
Previously, each wallet tab (Tokens, NFTs, DeFi Positions, Predictions)
used virtualized lists (FlashList/FlatList) with individual scroll
containers. This approach caused:
- Performance overhead from multiple virtualized lists
- Complex scroll coordination issues
- Inconsistent scroll behavior across tabs
- Memory overhead from maintaining multiple list states
**What is the improvement/solution?**
This PR consolidates scrolling by:
1. **Enabling scroll at the wallet page level** - The entire wallet page
now scrolls as a single container
2. **Removing scroll from individual tabs** - Each tab (Tokens, NFTs,
DeFi, Predictions) now renders content statically without
FlashList/FlatList when scroll is disabled at the tab level
3. **Adding skeleton loaders** - New skeleton components provide better
loading states (TokenListSkeleton, NftGridSkeleton)
4. **Adding empty state components** - Improved empty state handling
with dedicated components (TokensEmptyState)
The changes affect:
- **Tokens tab**: Replaced FlashList with static rendering when scroll
disabled
- **NFT Grid**: Removed FlashList, uses ScrollView-compatible layout
- **DeFi Positions**: Removed FlatList in favor of direct rendering
- **Predictions tab**: Removed FlashList, uses static layout
- **Wallet page**: Added ScrollView wrapper for unified scrolling
This architecture pairs with the TabsList auto-height capability (in
`fix/tab-individual-height`) to allow each tab to display all content
with the page-level scroll handling navigation between sections.
## **Changelog**
CHANGELOG entry: Improved wallet page scrolling performance by
consolidating scroll behavior at the page level
## **Related issues**
Fixes:
https://consensyssoftware.atlassian.net/jira/software/c/projects/DSYS/boards/1888?selectedIssue=DSYS-250
## **Manual testing steps**
```gherkin
Feature: Wallet page scroll improvements
Scenario: user scrolls through wallet tabs
Given user is on the Wallet page with tokens
When user scrolls down
Then the entire page scrolls smoothly
And all tabs remain accessible
And tab content loads without flickering
Scenario: user switches between tabs
Given user is on the Wallet page
When user taps on different tabs (Tokens, NFTs, DeFi, Predictions)
Then each tab displays content without FlashList artifacts
And scroll position resets appropriately per tab
And tab transitions are smooth
Scenario: user views empty states
Given user has no tokens/NFTs/positions
When user navigates to empty tabs
Then appropriate empty state messages display
And layout remains stable
Scenario: user views loading states
Given wallet data is loading
When user opens the wallet page
Then skeleton loaders display for each tab
And transitions to actual content are smooth
```
## **Screenshots/Recordings**
### **Before**
https://github.com/user-attachments/assets/28e93320-e519-4fc4-860f-1e5477d90bb9
https://github.com/user-attachments/assets/912fd548-c613-4fb5-9b5b-8dd864f20d2d
### **After**
When homepage redesign feature flag V1 is false
- Tokens Tab
https://github.com/user-attachments/assets/15809592-6066-48ee-a8b7-2af0a03cdb55
- NFTs Tab
https://github.com/user-attachments/assets/8b821113-fcf8-4416-a629-740571d49d59
- Perps Tab
https://github.com/user-attachments/assets/b364311c-6162-4f2a-bfbc-476daea5587a
- Defi Tab
https://github.com/user-attachments/assets/c59acab7-0cfa-4a75-92c5-4eb0bcd7b2a3
- Predictions Tab
https://github.com/user-attachments/assets/1f584e55-a0fd-40d9-9942-7ceb5335837f
When homepage redesign feature flag V1 is true
- Tokens Tab
https://github.com/user-attachments/assets/c10f0f2a-aa50-4f38-be42-b65d7f28d521
- NFTs Tab
https://github.com/user-attachments/assets/0263d21c-0bbc-4e57-8784-37eeecbdea60
- Perps Tab
https://github.com/user-attachments/assets/602db546-455c-462b-ab87-8f74624d0d73
- Defi Tab
https://github.com/user-attachments/assets/4a154aae-2245-42dd-bdca-e19a15eea68b
- Predictions Tab
https://github.com/user-attachments/assets/8fdfeeed-3cee-4ec2-b627-3fd8fe966166
<!-- Add recordings showing the new unified scroll behavior -->
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Enables global wallet scrolling and refactors
Tokens/NFTs/DeFi/Perps/Predict tabs to render without inner scroll
(behind homepageRedesignV1), adding skeleton loaders and empty states.
>
> - **Wallet**:
> - **Global Scroll**: Wraps wallet content in `ConditionalScrollView`
(new) to enable page-level scrolling; tabs pass content without inner
scroll when `homepageRedesignV1` is enabled.
> - **New Components**:
> - `components-temp/ConditionalScrollView` (+ types, tests).
> - `TokensEmptyState` and `TokenListSkeleton`; `NftGridSkeleton`.
> - **Tabs Refactor (flag-driven)**:
> - **Tokens**: `TokenList` renders items directly (no `FlashList`) when
not full view; adds skeleton and empty state; simplifies `Tokens`
(removes progressive loader) and applies `maxItems` (10) for homepage
redesign.
> - **NFTs**: `NftGrid` renders grid directly or via `FlashList` in full
view; adds skeleton, limits to 18 items with "View all"; UI tweaks in
`NftGridItem`.
> - **DeFi Positions**: Replace `FlatList` with direct render; optional
scroll via `ConditionalScrollView` and new testID for scroll view.
> - **Perps**: Use `ConditionalScrollView`; loading skeleton layout
adapts to flag.
> - **Predict**: Replace `FlashList` with direct render;
`PredictTabView` uses `ConditionalScrollView`.
> - **UI/Styling**:
> - Centered `CollectibleMedia` fallback text; minor layout cleanups;
token header back button `testID`.
> - **Tests & E2E**:
> - Extensive unit test updates for new render/flag behavior; add
skeleton/empty-state tests; update selectors (e.g.,
`DEFI_POSITIONS_SCROLL_VIEW`) and e2e token matcher to fetch first
instance.
> - **Localization**:
> - Adds `wallet.tokens_empty_description`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6bedb5f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent e0a8a4b commit 0c80dc9
File tree
49 files changed
+2278
-649
lines changed- app
- component-library/components-temp/ConditionalScrollView
- components
- UI
- AssetElement
- __snapshots__
- AssetOverview/Balance/__snapshots__
- Card/components/CardAssetItem/__snapshots__
- CollectibleMedia
- CollectibleModal/__snapshots__
- Collectibles/__snapshots__
- DeFiPositions
- Earn/components/EarnLendingBalance/__snapshots__
- NftGrid
- Perps
- Views/PerpsTabView
- components/PerpsLoadingSkeleton
- Predict
- components
- PredictPositionEmpty
- PredictPositionsHeader
- PredictPositions
- views/PredictTabView
- Stake/components/StakingBalance/__snapshots__
- TokensEmptyState
- Tokens
- TokenList
- Views
- Asset/__snapshots__
- TokensFullView
- Wallet
- confirmations/legacy/SendFlow/Amount/__snapshots__
- e2e
- pages/wallet
- selectors/wallet
- locales/languages
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
49 files changed
+2278
-649
lines changedLines changed: 101 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
268 | 267 | | |
269 | 268 | | |
270 | 269 | | |
271 | | - | |
272 | 270 | | |
273 | 271 | | |
274 | 272 | | |
| |||
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | 322 | | |
324 | 323 | | |
325 | 324 | | |
| |||
852 | 851 | | |
853 | 852 | | |
854 | 853 | | |
855 | | - | |
856 | 854 | | |
857 | 855 | | |
858 | 856 | | |
| |||
1329 | 1327 | | |
1330 | 1328 | | |
1331 | 1329 | | |
1332 | | - | |
1333 | 1330 | | |
1334 | 1331 | | |
1335 | 1332 | | |
| |||
1801 | 1798 | | |
1802 | 1799 | | |
1803 | 1800 | | |
1804 | | - | |
1805 | 1801 | | |
1806 | 1802 | | |
1807 | 1803 | | |
| |||
2273 | 2269 | | |
2274 | 2270 | | |
2275 | 2271 | | |
2276 | | - | |
2277 | 2272 | | |
2278 | 2273 | | |
2279 | 2274 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | | - | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
0 commit comments