Commit 42a758f
authored
feat: set NetworkManager bottom sheet to 75% height (#24493)
## **Description**
Modified the NetworkManager component to display the Networks bottom
sheet at 75% of screen height instead of expanding based on content.
This provides a more consistent and predictable UI experience when users
open the Networks modal.
**What is the reason for the change?**
The Networks bottom sheet was expanding to fit all content, there is a
design decision that there should be no BottomSheets that open 100%
height see ticket.
**What is the improvement/solution?**
Constrained the NetworkManager bottom sheet to exactly 75% of the screen
height with proper scrolling for content that exceeds this space. Also
added a close button (X icon) in the header for improved UX.
## **Changelog**
CHANGELOG entry: Updated Networks bottom sheet to open at 50% screen
height with improved header and close button
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/MDP-237
## **Manual testing steps**
```gherkin
Feature: Networks bottom sheet height constraint
Scenario: user opens Networks bottom sheet
Given the user is on the wallet home screen
When user taps on the network selector button
Then the Networks bottom sheet should open to exactly 75% of screen height
And the sheet should display a close button (X) in the top-right corner
And the content should be scrollable
Scenario: user interacts with Networks bottom sheet
Given the Networks bottom sheet is open at 75% height
When user scrolls through the network list
Then the sheet should remain at 75% height
And only the content should scroll
Scenario: user closes Networks bottom sheet
Given the Networks bottom sheet is open
When user taps the close button (X)
Then the bottom sheet should close with animation
And user should return to the home screen
Scenario: user swipes to dismiss bottom sheet
Given the Networks bottom sheet is open
When user swipes down on the sheet
Then the bottom sheet should dismiss
```
## **Screenshots/Recordings**
### **Before**
Networks bottom sheet expanded to fit all content (100% height) and no
close button
https://github.com/user-attachments/assets/da2023a4-bdd9-4980-8ce5-d634ba524119
### **After**
Networks bottom sheet constrained to 75% of screen height with
scrollable content and close button
https://github.com/user-attachments/assets/7f8c2ab5-94c5-4997-adf8-fdf45c0159df
## **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.
---
## Technical Details
**Changes made:**
1. **NetworkManager** (Primary Fix):
- Wrapped BottomSheet content in a View with fixed height constraint
- Added `BottomSheetHeader` with close button
- Created `scrollableTabView` style with `flex: 1`
- Removed unused imports and variables
2. **NetworkSelector** (Bonus Migration):
- Migrated from deprecated `ReusableModal` to `BottomSheet` component
- Added close button and 75% height constraint
- Cleaned up deprecated styles
**Key insight:**
The BottomSheetDialog uses `onLayout` to measure content height for
animation. By placing the height constraint on a wrapper View inside the
BottomSheet (rather than on the BottomSheet component itself), we ensure
the measured height is exactly 75%.
**Files changed:**
- `app/components/UI/NetworkManager/index.tsx`
- `app/components/UI/NetworkManager/index.styles.ts`
- `app/components/Views/NetworkSelector/NetworkSelector.tsx`
- `app/components/Views/NetworkSelector/NetworkSelector.styles.ts`
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Imposes a fixed-height Networks bottom sheet and modernizes
header/metrics usage.
>
> - Wraps BottomSheet content in a container with `height`/`maxHeight`
at `75%` of device height; removes safe-area-based sizing and legacy
sheet/title styles
> - Replaces inline title `Text` with `BottomSheetHeader` providing a
close action; adjusts layout to place `ScrollableTabView` directly
within the container
> - Refactors metrics: replaces
`MetaMetrics.getInstance().addTraitsToUser` with
`useMetrics().addTraitsToUser`; updates delete flow to use this and
keeps analytics tab tracking
> - Adds RPC selection modal wiring and EVM-only config mapping for
`RpcSelectionModal`
> - Renames `setNetworkMenuModal` -> `setShowNetworkMenuModal` and minor
cleanup of unused imports
> - Updates tests/mocks for new header and button icon components,
removes safe-area style assertion, and adapts deletion confirmation
assertions
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6d5c0dd. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 78b8f5a commit 42a758f
File tree
3 files changed
+72
-79
lines changed- app/components/UI/NetworkManager
3 files changed
+72
-79
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | 8 | | |
12 | 9 | | |
13 | 10 | | |
| |||
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
23 | | - | |
24 | 20 | | |
25 | 21 | | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 25 | | |
45 | 26 | | |
46 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
565 | 566 | | |
566 | 567 | | |
567 | 568 | | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
568 | 599 | | |
569 | 600 | | |
570 | 601 | | |
| |||
734 | 765 | | |
735 | 766 | | |
736 | 767 | | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | 768 | | |
750 | 769 | | |
751 | 770 | | |
| |||
859 | 878 | | |
860 | 879 | | |
861 | 880 | | |
862 | | - | |
| 881 | + | |
863 | 882 | | |
864 | 883 | | |
865 | 884 | | |
| |||
871 | 890 | | |
872 | 891 | | |
873 | 892 | | |
874 | | - | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
875 | 896 | | |
876 | 897 | | |
877 | 898 | | |
878 | 899 | | |
879 | 900 | | |
880 | | - | |
| 901 | + | |
881 | 902 | | |
882 | 903 | | |
883 | 904 | | |
| |||
888 | 909 | | |
889 | 910 | | |
890 | 911 | | |
891 | | - | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
892 | 915 | | |
893 | 916 | | |
894 | 917 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| |||
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 31 | + | |
36 | 32 | | |
37 | 33 | | |
38 | 34 | | |
| |||
90 | 86 | | |
91 | 87 | | |
92 | 88 | | |
93 | | - | |
94 | | - | |
| 89 | + | |
95 | 90 | | |
96 | 91 | | |
97 | 92 | | |
| |||
123 | 118 | | |
124 | 119 | | |
125 | 120 | | |
126 | | - | |
| 121 | + | |
127 | 122 | | |
128 | 123 | | |
129 | 124 | | |
| |||
160 | 155 | | |
161 | 156 | | |
162 | 157 | | |
163 | | - | |
164 | | - | |
| 158 | + | |
| 159 | + | |
165 | 160 | | |
166 | 161 | | |
167 | | - | |
| 162 | + | |
168 | 163 | | |
169 | 164 | | |
170 | 165 | | |
| |||
231 | 226 | | |
232 | 227 | | |
233 | 228 | | |
234 | | - | |
| 229 | + | |
235 | 230 | | |
236 | 231 | | |
237 | 232 | | |
| |||
240 | 235 | | |
241 | 236 | | |
242 | 237 | | |
243 | | - | |
| 238 | + | |
244 | 239 | | |
245 | 240 | | |
246 | 241 | | |
| |||
311 | 306 | | |
312 | 307 | | |
313 | 308 | | |
314 | | - | |
315 | | - | |
316 | | - | |
| 309 | + | |
317 | 310 | | |
318 | 311 | | |
319 | 312 | | |
320 | | - | |
| 313 | + | |
321 | 314 | | |
322 | 315 | | |
323 | 316 | | |
| |||
368 | 361 | | |
369 | 362 | | |
370 | 363 | | |
371 | | - | |
372 | 364 | | |
373 | 365 | | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
378 | 369 | | |
379 | 370 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
402 | 391 | | |
403 | 392 | | |
404 | 393 | | |
| |||
0 commit comments