Commit 408ab73
refactor(predict): remove unnecessary useNavigation generic types (#26564)
## **Description**
**Reason for the change:**
This is a preparatory change for upgrading the React Navigation library
to v6. With global default types now applied to the navigation API, we
no longer need to apply generic types to the `useNavigation` hook in
most cases.
**Improvement/Solution:**
- Removed generic types from `useNavigation` hook invocations (now uses
default global navigation types)
- Applied `NavigationProp<NavigatableRootParamList>` where deeply nested
navigation is required
- Part of a series of PRs splitting the cleanup by codebase ownership
**Note on exceptions:**
Generic types may still be needed when navigating to deeper nested
stacks. For those instances, we apply a recursive navigation type
pattern.
**References:**
- Parent issue: #23763
- React Navigation nesting docs:
https://reactnavigation.org/docs/nesting-navigators/
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes: #23763 (partial)
## **Manual testing steps**
```gherkin
Feature: Navigation functionality after useNavigation cleanup
Scenario: Predict navigation works correctly
Given the app is running
And the user is on the Predict section
When user navigates to any Predict screen
Then the navigation should complete successfully
And no TypeScript errors should occur
```
**Additional verification:**
- Run `yarn lint:tsc` to verify no TypeScript errors are introduced
- Run unit tests for affected components
## **Screenshots/Recordings**
N/A - No visual changes (internal refactoring/type cleanup)
## **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.
Made with [Cursor](https://cursor.com)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Primarily a TypeScript typing cleanup and unit-test refactor; runtime
behavior should be unchanged, with only light risk of missed
compile-time navigation type errors in Predict flows.
>
> **Overview**
> **Predict navigation typing cleanup.** Drops
`useNavigation<NavigationProp<...>>()` generics across multiple Predict
components/views/hooks in favor of default navigation types, with
corresponding import simplifications.
>
> **Test updates.** Refactors Predict unit tests to use
`renderWithProvider` and simpler mocks (notably `PredictActivityDetail`,
`PredictHomeFeaturedList`, `PredictHomePositionList`, and
`usePredictDeposit`), and adjusts `BrowserBottomBar` tests to expect
nested navigation params including `screen: 'AddBookmark'` when opening
`AddBookmarkView`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
a85f31b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent c247eb6 commit 408ab73
15 files changed
Lines changed: 911 additions & 1707 deletions
File tree
- app/components/UI
- BrowserBottomBar
- Predict
- components
- PredictActivityDetail
- PredictHome
- PredictMarketRowItem
- PredictMarketSportCard
- hooks
- views
- PredictBuyPreview
- PredictSellPreview
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| 394 | + | |
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
| |||
740 | 741 | | |
741 | 742 | | |
742 | 743 | | |
| 744 | + | |
743 | 745 | | |
744 | 746 | | |
745 | 747 | | |
| |||
760 | 762 | | |
761 | 763 | | |
762 | 764 | | |
| 765 | + | |
763 | 766 | | |
764 | 767 | | |
765 | 768 | | |
| |||
0 commit comments