fix(perps): apply safe area top inset directly to TPSL header cp-7.78.0#30503
Conversation
The shimmed SafeAreaView intermittently fails to apply the top inset on transparentModal screens, causing the header to overlap the status bar. Use useSafeAreaInsets hook on the header directly, matching the pattern used by PerpsOrderHeader.
|
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tags selected:
No other tags are needed as this change is isolated to the Perps TP/SL view layout and doesn't affect accounts, identity, network, browser, snaps, swap, or other flows. Performance Test Selection: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #30503 +/- ##
=======================================
Coverage 82.13% 82.14%
=======================================
Files 5488 5490 +2
Lines 147743 147787 +44
Branches 33969 33986 +17
=======================================
+ Hits 121353 121397 +44
Misses 18084 18084
Partials 8306 8306 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|



Description
The TPSL (Take Profit / Stop Loss) page header was intermittently positioned too high, overlapping the status bar / notch area. This occurred both when creating a TPSL from the order screen and when editing a TPSL for an open position.
Root cause: The screen relied on the shimmed
SafeAreaViewwithedges={['top', 'bottom']}to apply the top safe area inset. The shim (SafeAreaViewWithHookTopInset) turns off the native top inset and re-applies it via a hook-basedpaddingTop. With thetransparentModalpresentation mode used by this screen, the hook-based top inset was intermittently not applied, causing the header to render too high.Fix: Follow the same proven pattern used by
PerpsOrderHeader— apply the top inset directly to the header view usinguseSafeAreaInsets(), and only useSafeAreaViewfor the bottom edge. This is deterministic and does not depend on the shimmed SafeAreaView lifecycle for transparent modals.Changelog
CHANGELOG entry: Fixed TPSL page header overlapping the status bar area
Related issues
Fixes: TAT-3213
Manual testing steps
Screenshots/Recordings
Before
https://consensys.slack.com/archives/C092T3GPHQD/p1779353500168619
After
Header is consistently positioned below the safe area.
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Low risk UI layout change limited to safe-area handling in the Perps TPSL screen; no business logic or data flow changes.
Overview
Fixes an intermittent layout issue where the Perps TPSL header could render under the status bar/notch.
PerpsTPSLViewnow usesuseSafeAreaInsets()to add top padding directly on the header, and updatesSafeAreaViewto only apply the bottom safe area (edges={['bottom']}) so top inset behavior is deterministic in modal presentation.Reviewed by Cursor Bugbot for commit f3dd563. Bugbot is set up for automated code reviews on this repo. Configure here.