Skip to content

Commit 6806b97

Browse files
fix: replace ButtonIcon with HeaderCompactStandard in AddWallet (#29349)
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## **Description** The Add Wallet screen was using a custom `Box` with `ButtonIcon` for the back button, causing the back arrow to be misaligned compared to other screens that use the proper header components. This PR replaces the custom header implementation with `HeaderCompactStandard` from `app/component-library/components-temp/HeaderCompactStandard`, which ensures consistent back button positioning across the app. **Changes:** - Removed `ButtonIcon` import (no longer needed) - Replaced the custom `Box` + `ButtonIcon` wrapper (lines 90-97) with `HeaderCompactStandard` - Added `includesTopInset` prop for proper SafeAreaView handling - Preserved the existing `testID` for the back button ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: MUL-1773 ## **Manual testing steps** ```gherkin Feature: Add Wallet screen header alignment Scenario: user navigates to Add Wallet screen Given user is on the main wallet screen When user taps the account selector And user taps "Add wallet or hardware wallet" Then the back arrow should be aligned consistently with other screens (Import Private Key, Select Hardware Wallet) ``` ## **Screenshots/Recordings** ### **Before** The back arrow was misaligned due to custom `Box` + `ButtonIcon` implementation with different padding. ### **After** The back arrow is now aligned with other screens using `HeaderCompactStandard`. https://github.com/user-attachments/assets/d6217fbc-af7c-4992-bd4f-cb7e7e543bf4 ## **Pre-merge author checklist** - [x] 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). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] 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. #### Performance checks (if applicable) - [ ] I've tested on Android - [ ] I've tested with a power user scenario - [ ] I've instrumented key operations with Sentry traces for production performance metrics ## **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_AGENT_PR_BODY_END --> [Slack Thread](https://consensys.slack.com/archives/C09AYKX30P3/p1776873882245089?thread_ts=1776873882.245089&cid=C09AYKX30P3) <div><a href="https://cursor.com/agents/bc-a4f696ba-51fa-5471-abdf-52c43f6d450e"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-a4f696ba-51fa-5471-abdf-52c43f6d450e"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 0da8069 commit 6806b97

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

app/components/Views/AddWallet/AddWallet.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
BoxAlignItems,
88
BoxFlexDirection,
99
BoxJustifyContent,
10-
ButtonIcon,
1110
FontWeight,
1211
Icon,
1312
IconColor,
@@ -25,6 +24,7 @@ import { MetaMetricsEvents } from '../../../core/Analytics';
2524
import { IMetaMetricsEvent } from '../../../core/Analytics/MetaMetrics.types';
2625
import { useAnalytics } from '../../../components/hooks/useAnalytics/useAnalytics';
2726
import { AddWalletTestIds } from './AddWallet.testIds';
27+
import HeaderCompactStandard from '../../../component-library/components-temp/HeaderCompactStandard';
2828

2929
interface ActionConfig {
3030
analyticsEvent: IMetaMetricsEvent;
@@ -87,14 +87,13 @@ const AddWallet = () => {
8787
return (
8888
<SafeAreaView style={tw`flex-1 bg-default`} edges={['top', 'bottom']}>
8989
<Box testID={AddWalletTestIds.SCREEN} twClassName="flex-1 bg-default">
90-
<Box twClassName="px-2 py-4">
91-
<ButtonIcon
92-
accessibilityLabel="Back"
93-
iconName={IconName.ArrowLeft}
94-
onPress={handleBack}
95-
testID={AddWalletTestIds.BACK_BUTTON}
96-
/>
97-
</Box>
90+
<HeaderCompactStandard
91+
backButtonProps={{
92+
accessibilityLabel: strings('navigation.back'),
93+
onPress: handleBack,
94+
testID: AddWalletTestIds.BACK_BUTTON,
95+
}}
96+
/>
9897

9998
<Box gap={6} paddingHorizontal={4}>
10099
<Text color={TextColor.TextDefault} variant={TextVariant.HeadingLg}>

app/components/Views/ConnectHardware/SelectHardware/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,7 @@ const SelectHardwareWallet = () => {
187187
backgroundColor: colors.background.default,
188188
})}
189189
>
190-
<HeaderCompactStandard
191-
includesTopInset
192-
onBack={navigation.goBack}
193-
twClassName="px-3"
194-
/>
190+
<HeaderCompactStandard includesTopInset onBack={navigation.goBack} />
195191
<TitleStandard
196192
title={strings('connect_hardware.title_select_hardware')}
197193
twClassName="px-4 pb-6"

0 commit comments

Comments
 (0)