Commit 1e2f7ca
authored
fix: hide trending and show browser when ff is false (MetaMask#22209)
<!--
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**
This PR implements a complete navigation flow for the Trending feature,
allowing users to browse web content from within the Trending tab
without modifying the bottom navigation structure.
you should set the two env vars:
```
export OVERRIDE_REMOTE_FEATURE_FLAGS="true"
export ASSETS_TRENDING_TOKENS_ENABLED="true"
```
### Key Changes:
1. **TrendingView Stack Navigator**: Converted TrendingView to use a
Stack Navigator with two routes:
- `TrendingFeed`: Pure React Native "coming soon" screen with an Explore
button
- `TrendingBrowser`: Full Browser component with all features (tabs, URL
bar, search)
2. **Native Coming Soon Screen**: Replaced WebView-based HTML content
with native React Native components using
`@metamask/design-system-react-native`
3. **Navigation Flow**: Users can tap the Explore button (🔍) in
TrendingFeed to open the Browser with the MetaMask portfolio, browse any
website, and navigate back using:
- ← Back arrow button (left side of URL bar)
- ✕ Close button (right side of URL bar)
4. **Back Button Implementation**: Added a back button in `BrowserTab`
that:
- Appears on the left side of BrowserUrlBar
- Only shows when `fromTrending && isAssetsTrendingTokensEnabled` is
true
- Uses `navigation.goBack()` to return to TrendingFeed
5. **No MainNavigator Changes**: All navigation is self-contained within
TrendingView's Stack Navigator, maintaining the existing bottom tab
structure
## **Changelog**
CHANGELOG entry: Implemented Trending view with browser navigation
support
## **Related issues**
Fixes: N/A
## **Manual testing steps**
### **Before**
- Trending tab showed WebView with HTML-based "coming soon" message
- No way to access browser functionality from Trending tab
### **After**
- Trending tab shows native React Native "coming soon" screen
- Explore button opens full browser experience
- Back button allows easy return to Trending feed
- Complete browser functionality available within Trending context
https://github.com/user-attachments/assets/4a37f02b-3c1b-4f85-a6fa-f319221e688f
## **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.
- [x] I've converted TrendingView from WebView to native React Native
components
- [x] I've implemented a Stack Navigator for proper navigation flow
- [x] I've added back button functionality that respects the feature
flag
## **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.
- [ ] I've verified the Explore button opens the browser with portfolio
- [ ] I've verified the back button (←) and close button (✕) both
navigate back to Trending
- [ ] I've verified the back button only appears when navigating from
Trending
- [ ] I've verified all browser features work correctly (tabs, URL bar,
search, history)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Introduces a stack navigator for Trending with a native feed and
embedded browser, adds a back button in BrowserTab, and conditionally
shows Trending tab via feature flag with last-screen persistence.
>
> - **Trending navigation (stack-based)**:
> - Add `TrendingView` as a stack with `TrendingFeed` (native "coming
soon") and `TrendingBrowser` (wrapped `Browser`).
> - Intercept navigation in `BrowserWrapper` to `goBack` when targeting
`Routes.TRENDING_VIEW`.
> - Persist last viewed screen via `lastTrendingScreenRef` and
`updateLastTrendingScreen`.
> - Explore button navigates to `TrendingBrowser` with `newTabUrl`,
`timestamp`, and `fromTrending`.
> - **Browser tab UI/behavior**:
> - Add left-side back button in `BrowserTab` header (Design System
`ButtonIcon`) when assets trending flag is enabled; navigates to
`TrendingFeed`.
> - Refactor URL bar container to include back button; simplify cancel
behavior; keep close button visibility for `fromTrending &&
isAssetsTrendingTokensEnabled`.
> - **Main tabs logic**:
> - Conditionally show `Trending` tab (or fallback to `Browser` tab)
based on `assetsTrendingTokens` flag.
> - **Tests & snapshots**:
> - Update `TrendingView.test.tsx` for new stack flow and navigation
params.
> - Update BrowserTab snapshot to reflect new header layout.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8eeba12. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent a80db11 commit 1e2f7ca
5 files changed
Lines changed: 377 additions & 252 deletions
File tree
- app/components
- Views
- BrowserTab
- __snapshots__
- TrendingView
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
274 | 283 | | |
275 | 284 | | |
276 | 285 | | |
| |||
667 | 676 | | |
668 | 677 | | |
669 | 678 | | |
670 | | - | |
| 679 | + | |
671 | 680 | | |
672 | 681 | | |
673 | 682 | | |
674 | 683 | | |
675 | 684 | | |
676 | 685 | | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
677 | 698 | | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | 699 | | |
688 | 700 | | |
689 | 701 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
125 | 133 | | |
126 | 134 | | |
127 | 135 | | |
| |||
1354 | 1362 | | |
1355 | 1363 | | |
1356 | 1364 | | |
1357 | | - | |
1358 | | - | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
1363 | 1368 | | |
| 1369 | + | |
1364 | 1370 | | |
1365 | 1371 | | |
1366 | 1372 | | |
1367 | 1373 | | |
1368 | 1374 | | |
1369 | | - | |
1370 | | - | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
1374 | | - | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
1375 | 1378 | | |
1376 | 1379 | | |
1377 | 1380 | | |
| |||
1494 | 1497 | | |
1495 | 1498 | | |
1496 | 1499 | | |
1497 | | - | |
1498 | | - | |
1499 | | - | |
1500 | | - | |
1501 | | - | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
1505 | | - | |
1506 | | - | |
1507 | | - | |
1508 | | - | |
1509 | | - | |
1510 | | - | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
1511 | 1531 | | |
1512 | 1532 | | |
1513 | 1533 | | |
| |||
0 commit comments