Skip to content

Commit 8aa5a56

Browse files
authored
refactor: remove ScreenComponent any cast from Ramp Deposit routes (MetaMask#28114)
## **Description** Migrate the local `MainRoutes` component in Ramp Deposit routes from prop-based route access to `useRoute()` hook, eliminating the `type ScreenComponent = React.ComponentType<any>` escape hatch. Part of the React Navigation v6 migration effort to remove `no-explicit-any` violations from route files. **Changes:** - **`routes/index.tsx`**: Switch `MainRoutes` to `useRoute()`, remove `MainRoutesProps`, `ScreenComponent` alias, and cast ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** N/A — pure refactoring with no user-facing behavior change. ## **Screenshots/Recordings** ### **Before** N/A ### **After** N/A ## **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** > Low risk refactor limited to navigation param plumbing; behavior should remain unchanged aside from potential typing/runtime differences if the route context is misconfigured. > > **Overview** > Refactors `app/components/UI/Ramp/Deposit/routes/index.tsx` so `MainRoutes` no longer accepts a `route` prop and instead pulls `DepositNavigationParams` from React Navigation via `useRoute()`. > > This removes the local `MainRoutesProps` typing and updates imports accordingly, aiming to simplify typing and reduce `any`-style escape hatches during the React Navigation v6 migration. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b1db237. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 0232dd7 commit 8aa5a56

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

  • app/components/UI/Ramp/Deposit/routes

app/components/UI/Ramp/Deposit/routes/index.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
createStackNavigator,
44
StackNavigationOptions,
55
} from '@react-navigation/stack';
6-
import { RouteProp } from '@react-navigation/native';
6+
import { RouteProp, useRoute } from '@react-navigation/native';
77
import { BuyQuote } from '@consensys/native-ramps-sdk';
88
import { DepositSDKProvider } from '../sdk';
99
import { DepositNavigationParams } from '../types';
@@ -72,11 +72,9 @@ const getAnimationOptions = ({
7272
return { animationEnabled };
7373
};
7474

75-
interface MainRoutesProps {
76-
route: RouteProp<{ params: DepositNavigationParams }, 'params'>;
77-
}
78-
79-
const MainRoutes = ({ route }: MainRoutesProps) => {
75+
const MainRoutes = () => {
76+
const route =
77+
useRoute<RouteProp<{ params: DepositNavigationParams }, 'params'>>();
8078
const parentParams = route.params;
8179

8280
return (

0 commit comments

Comments
 (0)