Skip to content

refactor: remove ScreenComponent any cast from Ramp Deposit routes#28114

Merged
asalsys merged 4 commits intomainfrom
refactor/remove-screen-component-any-ramp
Mar 31, 2026
Merged

refactor: remove ScreenComponent any cast from Ramp Deposit routes#28114
asalsys merged 4 commits intomainfrom
refactor/remove-screen-component-any-ramp

Conversation

@asalsys
Copy link
Copy Markdown
Contributor

@asalsys asalsys commented Mar 30, 2026

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

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


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.

Written by Cursor Bugbot for commit b1db237. This will update automatically on new commits. Configure here.

@asalsys asalsys self-assigned this Mar 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Mar 30, 2026
@asalsys asalsys marked this pull request as ready for review March 31, 2026 14:12
Base automatically changed from feat/react-navigation-v6-migration to main March 31, 2026 15:02
@andrepimenta andrepimenta requested review from a team as code owners March 31, 2026 15:02
@github-actions github-actions bot added size-XS risk-medium Moderate testing recommended · Possible bug introduction risk and removed size-S labels Mar 31, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

}

const MainRoutes = ({ route }: MainRoutesProps) => {
const MainRoutes = () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ScreenComponent any cast not removed as intended

Low Severity

The type ScreenComponent = React.ComponentType<any> alias (line 56), its eslint-disable comment (line 55), and the as ScreenComponent cast on line 205 were all supposed to be removed per the PR title and description, but they remain. Now that MainRoutes accepts no props, the cast is unnecessary — a bare () => JSX.Element is already assignable to the navigator's component prop. The no-explicit-any violation this PR was designed to eliminate is still present.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do this in clean up pr

Migrate MainRoutes component in Ramp Deposit routes from prop-based
route access to useRoute() hook, eliminating the
type ScreenComponent = React.ComponentType<any> escape hatch.

Made-with: Cursor
@asalsys asalsys force-pushed the refactor/remove-screen-component-any-ramp branch from 2c21790 to 7581ed2 Compare March 31, 2026 15:17
@github-actions github-actions bot removed the risk-medium Moderate testing recommended · Possible bug introduction risk label Mar 31, 2026
@asalsys asalsys removed request for a team March 31, 2026 15:30
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2026
@github-actions github-actions bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Mar 31, 2026
@asalsys asalsys reopened this Mar 31, 2026
@github-actions github-actions bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Mar 31, 2026
@asalsys asalsys removed the risk-low Low testing needed · Low bug introduction risk label Mar 31, 2026
@github-actions github-actions bot added the risk-low Low testing needed · Low bug introduction risk label Mar 31, 2026
@MetaMask MetaMask unlocked this conversation Mar 31, 2026
@github-actions github-actions bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeRamps
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
The change is a minimal internal refactor in the Deposit (on-ramp) routing component. It replaces prop-based route access ({ route }: MainRoutesProps) with the useRoute() hook from @react-navigation/native. The behavior is functionally identical — route.params is still accessed the same way, just via a hook instead of a prop. No navigation structure, business logic, or other components are affected. SmokeRamps is the appropriate tag as it covers fiat on-ramp/off-ramp features, which is exactly what the Deposit flow is part of. No other tags are needed since this change is isolated to the Deposit routing component and doesn't touch confirmations, accounts, networks, or any other feature areas.

Performance Test Selection:
This is a pure refactor replacing prop-based route access with the useRoute() hook. There is no change to rendering logic, data loading, state management, or any performance-sensitive code path. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
18 value mismatches detected (expected — fixture represents an existing user).
View details

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-low Low testing needed · Low bug introduction risk size-XS team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants