Skip to content

feat: add tab navigation for limit and recurring orders - #34824

Open
GeorgeGkas wants to merge 3 commits into
swaps-4902from
swaps-4943
Open

feat: add tab navigation for limit and recurring orders#34824
GeorgeGkas wants to merge 3 commits into
swaps-4902from
swaps-4943

Conversation

@GeorgeGkas

@GeorgeGkas GeorgeGkas commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Description

Upcoming Swap/Bridge features (Limit Order and Recurring Buy) need a shared entry point alongside the existing market-order flow. This PR introduces a tab-based navigation shell in BridgeView and moves the current swap/bridge UI into a dedicated BridgeMarketView, leaving placeholder views for the WIP Limit and Recurring tabs.

Reason: The swaps team is building Limit Order and Recurring Buy on top of the existing Bridge screen. A tab system is required to host those flows without duplicating header, navigation, and lifecycle logic.

Solution:

  • Refactored BridgeView into a lightweight tab container with TabsBar, swipe gestures, and deferred content rendering via startTransition for smoother tab presses.
  • Extracted the existing market swap/bridge experience into BridgeMarketView (including footer, styles, and utils renames).
  • Added BridgeLimitOrderView and BridgeRecurringBuyView as placeholder containers behind remote feature flags (swapsLimitOrder, swapsRecurringBuy) with local env overrides (MM_BRIDGE_LIMIT_ORDER_TAB_ENABLED, MM_BRIDGE_RECURRING_BUY_TAB_ENABLED).
  • When both WIP flags are disabled, only the Market tab remains and the tabs bar is hidden — preserving today's user experience.
  • Slippage settings in the header appear only on the Market tab.
  • Tab switches clear amount inputs and stop BridgeController quote polling while preserving selected tokens; leaving the Bridge screen fully resets bridge state.

Changelog

CHANGELOG entry: null

Related issues

Refs: https://consensyssoftware.atlassian.net/browse/SWAPS-4943

Manual testing steps

Feature: Bridge tab navigation for Swap and Bridge

  Background:
    Given I am logged into MetaMask Mobile
    And remote feature flags swapsLimitOrder and swapsRecurringBuy are disabled

  Scenario: user opens Swap with WIP tabs disabled (production default)
    Given I navigate to the Swap screen from the wallet

    When the Swap screen loads
    Then I should not see a tabs bar
    And I should see the existing market swap UI (token inputs, quote details, confirm button)
    And I should see the slippage settings button in the header

  Scenario: user opens Swap with both WIP tabs enabled via remote flags
    Given remote feature flags swapsLimitOrder and swapsRecurringBuy are enabled
    And I navigate to the Swap screen

    When the Swap screen loads
    Then I should see a tabs bar with "Market", "Limit", and "Recurring" labels
    And the Market tab content should be visible by default
    And the slippage settings button should be visible in the header

    When I tap the "Limit" tab
    Then the Limit tab placeholder content should appear
    And the market token input areas should no longer be visible
    And the slippage settings button should be hidden

    When I tap the "Market" tab
    Then the market swap UI should be restored
    And the slippage settings button should reappear

    When I tap the "Recurring" tab
    Then the Recurring tab placeholder content should appear

  Scenario: user enables a single WIP tab locally for development
    Given MM_BRIDGE_LIMIT_ORDER_TAB_ENABLED is set to "true" in .js.env
    And MM_BRIDGE_RECURRING_BUY_TAB_ENABLED is not set or is "false"
    And remote feature flags for both tabs are absent or disabled

    When I navigate to the Swap screen
    Then I should see a tabs bar with "Market" and "Limit" only
    And tapping "Limit" should show the Limit placeholder view

  Scenario: user performs a market swap after tab navigation
    Given remote feature flags swapsLimitOrder and swapsRecurringBuy are enabled
    And I navigate to the Swap screen with tokens selected and an amount entered

    When I tap the "Limit" tab and return to the "Market" tab
    Then the selected token pair should be preserved
    And the amount input should be cleared

    When I enter a new amount and proceed with a swap
    Then the existing market swap flow should behave as before this change

Screenshots/Recordings

Before

N/A

After

N/A — screenshots recommended when validating with WIP feature flags enabled (tabs bar visible with Market / Limit / Recurring labels).

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

Note

Low Risk
Localized Bridge navigation UX and gesture wiring with unit tests; no swap execution, auth, or data-layer changes.

Overview
Bridge tab content now responds to horizontal swipes: left moves to the next tab (when one exists), right moves to the previous tab, and a right swipe on the first tab calls goBack (including when only Market is shown and the tabs bar is hidden).

The pan handler is on a GestureDetector around the tab body, with thresholds on translation/velocity and scheduleOnRN so tab changes run on the JS thread. New test IDs support gesture tests via react-native-gesture-handler/jest-utils.

Navigation: the Bridge stack screen sets gestureEnabled: false on top of slideFromRightNativeOptions so the OS back-swipe does not fight in-screen tab swipes.

Reviewed by Cursor Bugbot for commit c7803f1. Bugbot is set up for automated code reviews on this repo. Configure here.

@GeorgeGkas
GeorgeGkas requested a review from a team as a code owner August 14, 2026 16:44
@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Aug 14, 2026
@metamask-ci metamask-ci Bot added the team-swaps-and-bridge Swaps and Bridge team label Aug 14, 2026
Comment thread app/components/UI/Bridge/Views/BridgeView/index.tsx
@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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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.

Reviewed by Cursor Bugbot for commit ed550a7. Configure here.

Comment thread app/components/UI/Bridge/Views/BridgeView/index.tsx Outdated
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. size-M team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant