Commit d76192c
authored
fix: Fix UI issue related to SafeAreaView top inset recalculation cp-7.73.0 (#28622)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
We're experiencing an issue where the SafeAreaView top padding gets
recalculated upon component mount, which results in bad UI. This PR
reduces the blast radius of the changes by consolidating all
SafeAreaView imports to `react-native-safe-area-context`. We then create
a shim for the module, which handles applying top insets via style
instead. Changes also includes:
- Consolidate safe area context mocks in test setup file
- Remove unused safe area mocks within test files
- Update snapshots
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry:
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
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**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches SafeAreaView usage across many screens, so incorrect
inset/edge handling could cause widespread layout regressions on
iOS/Android despite being mostly mechanical changes.
>
> **Overview**
> Standardizes `SafeAreaView` usage by switching many components from
`react-native` to `react-native-safe-area-context` (including adding
explicit `edges` in a few places) to avoid incorrect top-inset
recalculation on mount.
>
> Refactors navigation/header configuration for
`DeFiProtocolPositionDetails` by moving `setOptions` logic out of the
component and into `MainNavigator` options via
`getDeFiProtocolPositionDetailsNavbarOptions` (now explicitly sets
`headerShown: true`).
>
> Cleans up tests by removing per-file safe-area mocks in favor of the
centralized jest mock in `testSetupView.js`, and updates
snapshots/expectations accordingly.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f88a0cf. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 894a971 commit d76192c
File tree
216 files changed
+946
-2321
lines changed- app
- component-library
- components-temp
- HeaderRoot
- HeaderStandardAnimated
- MultichainAccounts/MultichainAddWalletActions
- components
- BottomSheets/BottomSheet/foundation/BottomSheetDialog
- Toast
- components
- Base
- UI
- AccountNetworkIndicator/__snapshots__
- AccountRightButton/__snapshots__
- BasicFunctionality/BasicFunctionalityModal
- Bridge/components
- ApprovalText/__snapshots__
- BlockaidModal
- BridgeTokenSelector
- MarketClosedBottomSheets/__snapshots__
- QuoteDetailsCard/__snapshots__
- Card
- Views
- ChooseYourCard
- OrderCompleted
- ReviewOrder
- components
- AssetSelectionBottomSheet
- Onboarding
- WaitlistFormModal
- CollectibleContractInformation
- CollectibleOverview
- CustomNetworkSelector
- DeFiPositions
- DeleteWalletModal/__snapshots__
- Earn
- LendingLearnMoreModal/__snapshots__
- Views
- EarnInputView/__snapshots__
- EarnWithdrawInputView/__snapshots__
- components
- EarnTokenList/__snapshots__
- MaxInputModal/__snapshots__
- FoxAnimation
- FundActionMenu
- Identity/ConfirmTurnOnBackupAndSyncModal
- MarketInsights/Views/MarketInsightsView
- Money
- Views/MoneyHomeView
- NetworkManager
- NetworkMultiSelectorList
- OptinMetrics/__snapshots__
- PermissionsSummary
- __snapshots__
- Perps
- Views
- PerpsAdjustMarginView
- PerpsHeroCardView
- PerpsHomeView
- PerpsOrderDetailsView
- PerpsTPSLView
- components
- PerpsCandlePeriodBottomSheet
- PerpsChartFullscreenModal
- PerpsCrossMarginWarningBottomSheet
- PerpsLeverageBottomSheet
- PerpsLimitPriceBottomSheet
- PerpsOrderTypeBottomSheet
- PerpsTutorialCarousel
- Predict
- components
- PredictCryptoUpDownDetails
- PredictDetailsHeaderSkeleton
- PredictGameDetailsContent
- views/PredictMarketDetails
- Ramp/Views
- Checkout
- Modals/ProcessingInfoModal
- ReusableModal
- __snapshots__
- Rewards/Views
- Screen
- __snapshots__
- SecurityTrust/Views
- SelectOptionSheet/__snapshots__
- Stake/components
- GasImpactModal/__snapshots__
- PoolStakingLearnMoreModal/__snapshots__
- SwitchCustomNetwork/__snapshots__
- Tabs
- __snapshots__
- TokenDetails/components
- Tokens/TokenSortBottomSheet
- TurnOffRememberMeModal
- UpdateNeeded/__snapshots__
- Views
- AccountActions
- AccountBackupStep1B
- AccountBackupStep1/__snapshots__
- AccountConnect
- AccountConnectMaliciousWarning
- AccountConnectMultiSelector
- __snapshots__
- AddAccount
- __snapshots__
- AccountPermissions
- AccountPermissionsConfirmRevokeAll
- AccountStatus/__snapshots__
- ActivityView/__snapshots__
- AddAccountActions
- __snapshots__
- AddAsset
- Views/ConfirmAddTokenView
- components/NetworkListBottomSheet
- AddBookmark
- __snapshots__
- AddNewAccount
- AddressSelector/__snapshots__
- AesCryptoTestForm
- __snapshots__
- AssetOptions
- Browser
- __snapshots__
- ChoosePassword/__snapshots__
- CollectibleView
- __snapshots__
- DataCollectionModal
- __snapshots__
- EditAccountName
- EnterPasswordSimple
- __snapshots__
- ImportFromSecretRecoveryPhrase/__snapshots__
- ImportPrivateKeySuccess/__snapshots__
- ImportPrivateKey/__snapshots__
- Login
- ManualBackupStep1/__snapshots__
- MediaPlayer
- MultiRpcModal/__snapshots__
- MultichainAccounts
- AccountDetails
- AccountTypes/BaseAccountDetails
- AccountGroupDetails
- MultichainAccountConnect
- MultichainAccountPermissions
- MultichainPermissionsSummary
- sheets
- DeleteAccount
- EditAccountName
- EditMultichainAccountName
- MultichainAccountActions
- RevealSRP
- NFTAutoDetectionModal/__snapshots__
- NetworkConnect/NetworkConnectMultiSelector
- NetworkSelector/RpcSelectionModal
- NetworksManagement
- NetworkDetailsView
- components
- NftDetails
- __snapshots__
- NftOptions
- Notifications/Details
- OAuthRehydration
- OfflineMode
- __snapshots__
- OnboardingSheet
- OnboardingSuccess
- OnboardingGeneralSettings/__snapshots__
- __snapshots__
- Onboarding/__snapshots__
- ResetPassword/__snapshots__
- RestoreWallet/__snapshots__
- Root
- SDK
- SDKDisconnectModal
- SDKSessionModal
- SDKSessionsManager
- Settings
- AdvancedSettings/FiatOnTestnetsFriction
- Contacts/ContactForm
- PermissionsSettings
- PermissionItem
- ShowDisplayMediaNFTSheet/__snapshots__
- ShowIpfsGatewaySheet/__snapshots__
- ShowTokenIdSheet/__snapshots__
- SimpleWebview/__snapshots__
- Snaps
- KeyringSnapRemovalWarning/test
- SnapSettings
- test
- SocialLoginIosUser/__snapshots__
- TradeWalletActions
- TransactionsView/__snapshots__
- TrendingView/Views/ExploreSectionResultsFullView
- WalletActions
- WalletConnectSessions/__snapshots__
- WalletCreationError
- WalletRecovery/__snapshots__
- Wallet/__snapshots__
- confirmations
- components
- AccountSelector
- confirm
- info/custom-amount-info
- modals/switch-account-type-modal
- hooks/send
- legacy/components/CustomNonceModal
- __snapshots__
- declarations
- features/SampleFeature/components/views/SamplePetNames
- __snapshots__
- shims
- util/test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
216 files changed
+946
-2321
lines changedLines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
250 | 246 | | |
251 | 247 | | |
252 | 248 | | |
253 | | - | |
| 249 | + | |
254 | 250 | | |
255 | 251 | | |
256 | 252 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 21 | | |
26 | 22 | | |
27 | 23 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
Lines changed: 0 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 24 | | |
39 | 25 | | |
40 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | 28 | | |
33 | 29 | | |
34 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | 456 | | |
472 | 457 | | |
473 | 458 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
| |||
1310 | 1311 | | |
1311 | 1312 | | |
1312 | 1313 | | |
1313 | | - | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
1314 | 1318 | | |
1315 | 1319 | | |
1316 | 1320 | | |
| |||
Lines changed: 3 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
| 390 | + | |
397 | 391 | | |
398 | 392 | | |
399 | 393 | | |
| |||
816 | 810 | | |
817 | 811 | | |
818 | 812 | | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
| 813 | + | |
826 | 814 | | |
827 | 815 | | |
828 | 816 | | |
| |||
1245 | 1233 | | |
1246 | 1234 | | |
1247 | 1235 | | |
1248 | | - | |
1249 | | - | |
1250 | | - | |
1251 | | - | |
1252 | | - | |
1253 | | - | |
1254 | | - | |
| 1236 | + | |
1255 | 1237 | | |
1256 | 1238 | | |
1257 | 1239 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
440 | 439 | | |
441 | 440 | | |
442 | 441 | | |
443 | | - | |
| 442 | + | |
444 | 443 | | |
445 | 444 | | |
0 commit comments