Commit a975b43
fix: Navigation behavior from PerpsHomeScreenSearch (#22013)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
Fixes incorrect search behavior from PerpsHomeView. We were handling two
different search behaviors in PerpsHomeScree and PerpsMarketListView.
Correct behavior is:
1. When search icon is pressed on the PerpsHomeView, it need to navigate
to the PerpsMarketListView with search enabled.
2. On cancel, it should go back to the PerpsMarketListView
3. When search icon is pressed from PerpsMarketListView, we enable
search as is currently does
4. When cancel is pressed it goes back to PerpsMarketListView
This PR removes the multi-dimensional search from the PerpsHomeScreen
view and instead navigates to the MarketListView as per the latest
designs.
## **Changelog**
CHANGELOG entry: Fixes search behavior in PerpsHomeScreen
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
https://github.com/user-attachments/assets/f747b86f-4080-44ab-9cdd-7a96add3b510
## **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]
> PerpsHomeView now navigates to PerpsMarketListView with search
pre-opened on search tap, with minor header padding tweak, a new
navigation param, and updated tests.
>
> - **Perps Home → Market List navigation**
> - Replace in-place search in `PerpsHomeView` with navigation to
`PerpsMarketListView` via `usePerpsNavigation.navigateToMarketList({
defaultSearchVisible: true, source: 'homescreen_tab', fromHome: true
})`.
> - Remove local search state and filtering from `PerpsHomeView`; call
`usePerpsHomeData({})`.
> - Header in `PerpsHomeHeader` is always rendered with
`isSearchVisible: false` on Home.
> - **Market List search handling**
> - Refactor `handleSearchToggle` in `PerpsMarketListView` to
`useCallback`; clears query on close and tracks event on open.
> - **Header UI tweak**
> - `PerpsMarketListHeader`: add `Platform`-specific padding for the
search bar (`py-3` iOS, `py-1` Android); import `Platform`. Mark
`onSearchClear` as unused.
> - **Navigation types**
> - Add `fromHome?: boolean` to
`PerpsNavigationParamList['PerpsMarketListView']`.
> - **Tests**
> - `PerpsHomeView.test.tsx`: mock `navigateToMarketList` and assert
navigation with `{ defaultSearchVisible: true, source: 'homescreen_tab',
fromHome: true }`; remove assertions about HomeView search bar
visibility; minor setup/mocks cleanup.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8218306. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Arthur Breton <arthur.breton@consensys.net>
Co-authored-by: abretonc7s <107169956+abretonc7s@users.noreply.github.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
Co-authored-by: tommasini <46944231+tommasini@users.noreply.github.com>
Co-authored-by: metamaskbot <metamaskbot@users.noreply.github.com>
Co-authored-by: Borislav Grigorov <b.s.grigorov@gmail.com>
Co-authored-by: Nicholas Smith <nick.smith@consensys.net>1 parent 9f14e3e commit a975b43
File tree
5 files changed
+31
-41
lines changed- app/components/UI/Perps
- Views
- PerpsHomeView
- PerpsMarketListView
- components/PerpsMarketListHeader
- types
5 files changed
+31
-41
lines changedLines changed: 13 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | | - | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
391 | 392 | | |
392 | 393 | | |
393 | 394 | | |
| 395 | + | |
394 | 396 | | |
395 | 397 | | |
396 | 398 | | |
| |||
420 | 422 | | |
421 | 423 | | |
422 | 424 | | |
423 | | - | |
| 425 | + | |
424 | 426 | | |
425 | 427 | | |
426 | 428 | | |
427 | | - | |
| 429 | + | |
428 | 430 | | |
429 | 431 | | |
430 | | - | |
| 432 | + | |
431 | 433 | | |
432 | 434 | | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
449 | 442 | | |
450 | 443 | | |
451 | 444 | | |
| |||
Lines changed: 10 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | 60 | | |
65 | 61 | | |
66 | 62 | | |
67 | 63 | | |
68 | 64 | | |
69 | 65 | | |
70 | | - | |
| 66 | + | |
71 | 67 | | |
72 | 68 | | |
73 | 69 | | |
| |||
78 | 74 | | |
79 | 75 | | |
80 | 76 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 77 | + | |
84 | 78 | | |
85 | 79 | | |
86 | 80 | | |
| |||
105 | 99 | | |
106 | 100 | | |
107 | 101 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
114 | 109 | | |
115 | 110 | | |
116 | 111 | | |
| |||
186 | 181 | | |
187 | 182 | | |
188 | 183 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
| 184 | + | |
193 | 185 | | |
194 | 186 | | |
195 | 187 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
| 348 | + | |
| 349 | + | |
349 | 350 | | |
350 | 351 | | |
351 | 352 | | |
| 353 | + | |
352 | 354 | | |
353 | 355 | | |
| 356 | + | |
354 | 357 | | |
355 | 358 | | |
356 | 359 | | |
357 | 360 | | |
358 | 361 | | |
359 | | - | |
| 362 | + | |
360 | 363 | | |
361 | 364 | | |
362 | 365 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
99 | | - | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| |||
0 commit comments