Skip to content

refactor: remove ScreenComponent any cast from Bridge routes#28113

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

refactor: remove ScreenComponent any cast from Bridge routes#28113
asalsys merged 4 commits intomainfrom
refactor/remove-screen-component-any-bridge

Conversation

@asalsys
Copy link
Copy Markdown
Contributor

@asalsys asalsys commented Mar 30, 2026

Description

Migrate BlockExplorersModal from prop-based route access to useRoute() hook with typed RouteProp generic, eliminating the type ScreenComponent = React.ComponentType<any> escape hatch from Bridge routes.

Part of the React Navigation v6 migration effort to remove no-explicit-any violations from route files.

Changes:

  • BlockExplorersModal.tsx: Switch from (props: BlockExplorersModalProps) to useRoute() hook
  • routes.tsx: Remove ScreenComponent type alias and as ScreenComponent cast
  • BlockExplorersModal.test.tsx: Mock useRoute() instead of passing route as prop

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

N/A — pure refactoring with no user-facing behavior change. Existing unit tests cover the affected component.

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 how route params are accessed and how tests set up navigation, with no expected behavioral changes beyond potential runtime issues if the route params are absent/mis-typed.

Overview
Refactors BlockExplorersModal to stop accepting a route prop and instead pull evmTxMeta/multiChainTx from React Navigation via useRoute() with a typed RouteProp.

Updates BlockExplorersModal.test.tsx to mock useRoute() and render the modal without passing route props, keeping existing assertions around explorer buttons and webview navigation.

Written by Cursor Bugbot for commit f2cc0ca. 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
@asalsys asalsys requested a review from a team as a code owner 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 the risk-high Extensive testing required · High bug introduction risk label Mar 31, 2026
Migrate BlockExplorersModal from prop-based route access to useRoute()
hook with typed RouteProp generic, eliminating the
type ScreenComponent = React.ComponentType<any> escape hatch.

Made-with: Cursor
@asalsys asalsys force-pushed the refactor/remove-screen-component-any-bridge branch from 7d74960 to 0a65ef5 Compare March 31, 2026 15:16
@github-actions github-actions bot added risk-low Low testing needed · Low bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 31, 2026
@asalsys
Copy link
Copy Markdown
Contributor Author

asalsys commented Mar 31, 2026

Closing: rebasing onto main since the navigation v6 branch was merged.

@asalsys asalsys removed request for a team March 31, 2026 15:29
@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: SmokeTrade
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are a localized refactoring of the BlockExplorersModal component within the Bridge transaction details feature. The component was updated to use React Navigation's useRoute() hook internally instead of receiving route params as props. This is a standard React Navigation pattern change with no logic modifications.

Key observations:

  1. No new functionality - pure refactoring of how route params are accessed
  2. Only affects BlockExplorersModal in the Bridge/TransactionDetails directory
  3. No shared components (TabBar, Browser, Modals, confirmations) are affected
  4. No controllers, Engine, or state management changes
  5. Test file updated to mock useRoute instead of passing props directly

SmokeTrade is selected because it covers bridge/swap flows including transaction details and history, which is where BlockExplorersModal is used. Per SmokeTrade's description, when selecting SmokeTrade for bridge flows, SmokeConfirmations should also be selected. However, since this is purely a UI refactoring of a modal that displays block explorer links (not the confirmation flow itself), and the risk is very low, SmokeConfirmations is included as a dependent tag per the tag description guidance.

Performance Test Selection:
The changes are a pure refactoring of how route params are accessed in a modal component (props vs useRoute hook). There are no performance implications - no new rendering logic, no data fetching changes, no list rendering, no state management changes. Performance tests are not 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

@asalsys asalsys enabled auto-merge March 31, 2026 17:13
@asalsys asalsys added this pull request to the merge queue Mar 31, 2026
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-S team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants