Skip to content

fix: perps safe area design regressions#30970

Merged
gambinish merged 12 commits into
mainfrom
fix/perps-design-bugs-safe-area-view
Jun 3, 2026
Merged

fix: perps safe area design regressions#30970
gambinish merged 12 commits into
mainfrom
fix/perps-design-bugs-safe-area-view

Conversation

@gambinish

@gambinish gambinish commented Jun 2, 2026

Copy link
Copy Markdown
Member

Description

Fix Perps UI layout and rendering issues
This PR addresses a collection of visual bugs found across the Perps order flow on iOS and Android.

What changed
Order header back button overlap The header was applying top: topInset as a relative offset, which visually shifted it down without affecting the layout box. This caused the back button to render on top of the amount input, making taps on the back button focus the input instead. Changed to paddingTop: topInset so the header grows correctly in the flex layout.

Android safe area for the order button The fixed "Place Order" button was jumping on re-render on Android. The root cause was spreading a StyleSheet object into a plain object inside useMemo, which made the base style reference unstable and caused Fabric to flash the un-overridden bottom: 0 before the dynamic value resolved. Separated the stable StyleSheet reference from the dynamic safe area padding using a style array.

TPSL back button vertical alignment The absolutely-positioned back button was missing top/bottom anchors, so it defaulted to top: 0 and ignored the parent's alignItems. Added top: 0, bottom: 0, and justifyContent: center so the icon sits centered with the header title.

Leverage bottom sheet button off-screen on iOS The bottom sheet's overflow: hidden was clipping the footer button when content exceeded the available height. Wrapped the scrollable content in a ScrollView with flexShrink: 1 and moved the footer outside it so the button is always visible and never clipped.

Leverage price icon color The Icon component's color prop was not being applied because a raw hex string was passed via the style prop instead of the color prop. Moved the color to the correct prop.

i18n and test coverage

  • Added the price_unavailable string to the leverage bottom sheet's i18n mock in tests (previously fell through to returning the key itself).
  • Fixed the PerpsFlipPositionConfirmSheet test's Icon mock to target @metamask/design-system-react-native instead of the local component library, which is what the component actually imports from.

Also replaced several instances of deprecated component library components. Namely Text and Icon

Changelog

CHANGELOG entry: SafeArea view style polish

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before:
Screenshot 2026-06-02 at 8 09 13 AM

After:
Screenshot 2026-06-02 at 10 06 51 AM

Also after (back arrow aligned):
Screenshot 2026-06-02 at 10 06 27 AM

Also after (order button not cut off on Samsung Galaxy):
Screenshot 2026-06-02 at 5 23 30 PM

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
Visual and layout-only changes across Perps trading UI with no trading logic or auth changes; test mocks updated for design-system imports.

Overview
Fixes Perps order-flow layout and safe-area regressions on iOS/Android, and aligns several screens with @metamask/design-system-react-native for Text/Icon (replacing deprecated component-library tokens like BodyMDBodyMd, TextColor.DefaultTextColor.TextDefault).

Order & TP/SL: PerpsOrderView wires onBack on PerpsOrderHeader and tightens info-section margins; PerpsAmountDisplay reduces top/horizontal padding. TP/SL header back control is repositioned (bottom + justifyContent: 'center') and gets a balancing empty column for title centering.

Leverage sheet: Content moves into a ScrollView so the confirm action stays visible; footer uses design-system BottomSheetFooter with primaryButtonProps; warning row layout and minHeight on the price block reduce jumps when price is missing; unavailable price copy is perps.order.leverage_modal.price_unavailable in en.json and tests.

Shared components: PerpsCloseSummary, PerpsFeesDisplay, and PerpsFlipPositionConfirmSheet get the same design-system migration; flip-confirm tests mock Icon from the design-system package.

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

@mm-token-exchange-service mm-token-exchange-service Bot added the team-perps Perps team label Jun 2, 2026
@github-actions github-actions Bot added the size-L label Jun 2, 2026
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: @PerformancePreps
  • Risk Level: medium
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 12 changed files are exclusively within the Perps feature area (app/components/UI/Perps/) plus a minor locales addition. The changes involve:

  1. Design system migration: Multiple Perps components migrated from internal component-library (Text, Icon, BottomSheet) to @metamask/design-system-react-native. This involves enum value renames (TextVariant.BodyMD → BodyMd, TextColor.Alternative → TextAlternative, IconColor.Alternative → IconAlternative, etc.) which could cause rendering issues if any enum values don't map correctly.

  2. PerpsLeverageBottomSheet: Significant refactoring - new ScrollView wrapper, updated BottomSheetFooter API (from buttonPropsArray to primaryButtonProps), removal of shouldNavigateBack prop, layout changes. This is a functional change that could affect the leverage selection flow.

  3. PerpsOrderView: Added onBack prop, color/variant token updates, margin adjustments.

  4. PerpsTPSLView: Header layout fix (added empty View for centering), color/variant token updates.

  5. PerpsCloseSummary, PerpsFeesDisplay, PerpsFlipPositionConfirmSheet: Design system token migrations.

  6. Locales: Added price_unavailable string for leverage modal.

Tag selection rationale:

  • SmokePerps: Primary tag - all changes are in Perps components (PerpsOrderView, PerpsTPSLView, PerpsLeverageBottomSheet, PerpsCloseSummary, PerpsFeesDisplay, PerpsFlipPositionConfirmSheet). The leverage bottom sheet refactoring and design system migration need validation.
  • SmokeWalletPlatform: Required by SmokePerps tag description - Perps is a section inside the Trending tab, so changes to Perps views affect Trending/WalletPlatform.
  • SmokeConfirmations: Required by SmokePerps tag description - Add Funds deposits are on-chain transactions that go through confirmations.

The risk is medium because while changes are scoped to Perps, the design system migration involves many enum value changes that could cause runtime errors if any values are incorrect, and the PerpsLeverageBottomSheet has significant structural refactoring.

Performance Test Selection:
The PerpsLeverageBottomSheet has significant structural changes (new ScrollView wrapper, updated BottomSheetFooter API) and PerpsAmountDisplay has padding changes. These UI structural changes in the Perps flow could affect rendering performance. @PerformancePreps covers perps market loading, position management, add funds flow, and order execution - all of which are touched by these changes.

View GitHub Actions results

@gambinish gambinish marked this pull request as ready for review June 3, 2026 01:46
@gambinish gambinish requested a review from a team as a code owner June 3, 2026 01:46

@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 3 potential issues.

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 ef51989. Configure here.

Comment thread app/components/UI/Perps/Views/PerpsTPSLView/PerpsTPSLView.tsx
Comment thread app/components/UI/Perps/Views/PerpsTPSLView/PerpsTPSLView.styles.ts
@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jun 3, 2026

@geositta geositta 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.

Looks good, did not find any issues.

@gambinish gambinish added this pull request to the merge queue Jun 3, 2026
Merged via the queue into main with commit 442b2f3 Jun 3, 2026
200 of 312 checks passed
@gambinish gambinish deleted the fix/perps-design-bugs-safe-area-view branch June 3, 2026 17:04
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 3, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.81.0 Issue or pull request that will be included in release 7.81.0 label Jun 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.81.0 Issue or pull request that will be included in release 7.81.0 risk:low AI analysis: low risk size-L team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants