Skip to content

Commit 4b978aa

Browse files
chore: remove Text component wrappers from BottomSheetHeader children (#22173)
## **Description** Removed `Text` component wrappers from `BottomSheetHeader` children across the codebase to ensure consistency with the new API pattern where `BottomSheetHeader` handles text styling internally. This refactoring removes redundant `Text` components that were wrapping string content inside `BottomSheetHeader`. The `BottomSheetHeader` component now handles the text styling directly, ensuring a consistent appearance across all bottom sheet headers in the app. ## **Changelog** CHANGELOG entry: null ## **Related issues** Part of: https://consensyssoftware.atlassian.net/browse/MDP-343 ## **Manual testing steps** ```gherkin Feature: Bottom Sheet Headers Display Correctly Scenario: user views various bottom sheets with headers Given the app is running When user opens any bottom sheet modal with a header (e.g., network selector, payment method selector, region selector, account permissions, etc.) Then the header text should display correctly with proper styling And the header should be visually consistent with other bottom sheet headers ``` ## **Screenshots/Recordings** ### **Before** N/A - Internal refactoring, no visual changes. We can trust the component to handle styling correctly. ### **After** N/A - Internal refactoring, no visual changes. We can trust the component to handle styling correctly. ## **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. ## **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. --- ### **Changes Summary** **11 component files updated:** - NetworkSettings/index.js (4 instances) - NetworkListBottomSheet.tsx - TooltipModal/index.tsx - AccountPermissionsConfirmRevokeAll.tsx - NetworkSelector/NetworkSelector.tsx - RpcSelectionModal/RpcSelectionModal.tsx - NetworkManager/index.tsx - PermittedNetworksInfoSheet.tsx - ConnectionDetails/ConnectionDetails.tsx - RegionSelectorModal/RegionSelectorModal.tsx - PaymentMethodSelectorModal.tsx **5 test snapshots updated:** - RegionSelectorModal (8 snapshots) - PaymentMethodSelectorModal (1 snapshot) - AccountPermissionsConfirmRevokeAll (1 snapshot) - ConnectionDetails (1 snapshot) - PermittedNetworksInfoSheet (1 snapshot) **Total:** 16 files changed, 54 insertions(+), 60 deletions(-) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Refactors BottomSheetHeader to take raw string children across modals/selectors and updates tests/snapshots and small header style expectations. > > - **UI/BottomSheetHeader refactor**: > - Replace `<Text>` wrappers with raw string children in `BottomSheetHeader` across: > - Bridge: `BlockaidModal`, `BridgeNetworkSelectorBase`, `BridgeTokenSelectorBase`, `QuoteExpiredModal`, `SlippageModal`, `TransactionDetails/BlockExplorersModal`. > - Ramp (Deposit): `PaymentMethodSelectorModal`, `RegionSelectorModal`. > - Account Permissions: `AccountPermissionsConfirmRevokeAll`, `ConnectionDetails`, `PermittedNetworksInfoSheet`. > - Networks: `NetworkManager`, `AddAsset/NetworkListBottomSheet`, `NetworkSelector`. > - Misc: `TooltipModal`. > - **Tests/Snapshots**: > - Update snapshots to new header structure: add `testID="header-title"`, center text, and expect fontSize 16. > - Adjust NetworkManager tests to assert `testID="header"` instead of mocked header ID; extend icon mocks. > - **Styles**: > - Remove unused `heading` style in `NetworkSettings` styles; align header typography via `BottomSheetHeader`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ddcd7e7. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent c930907 commit 4b978aa

File tree

29 files changed

+88
-115
lines changed

29 files changed

+88
-115
lines changed

app/components/UI/Bridge/components/BlockaidModal/BlockaidModal.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ const BlockaidModal = () => {
5959
return (
6060
<BottomSheet ref={sheetRef}>
6161
<BottomSheetHeader onClose={handleClose}>
62-
<Text variant={TextVariant.HeadingMD}>
63-
{strings(`blockaid_modal.${errorType}_title`)}
64-
</Text>
62+
{strings(`blockaid_modal.${errorType}_title`)}
6563
</BottomSheetHeader>
6664
<View style={styles.container}>
6765
<Text variant={TextVariant.BodyMD} style={styles.errorMessage}>

app/components/UI/Bridge/components/BridgeDestNetworkSelector/__snapshots__/BridgeDestNetworkSelector.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,14 +468,14 @@ exports[`BridgeDestNetworkSelector renders with initial state and displays netwo
468468
style={
469469
{
470470
"color": "#121314",
471-
"flex": 1,
472471
"fontFamily": "Geist Bold",
473-
"fontSize": 18,
472+
"fontSize": 16,
474473
"letterSpacing": 0,
475474
"lineHeight": 24,
476475
"textAlign": "center",
477476
}
478477
}
478+
testID="header-title"
479479
>
480480
Select network
481481
</Text>

app/components/UI/Bridge/components/BridgeDestTokenSelector/__snapshots__/BridgeDestTokenSelector.test.tsx.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,13 @@ exports[`BridgeDestTokenSelector renders with initial state and displays tokens
469469
{
470470
"color": "#121314",
471471
"fontFamily": "Geist Bold",
472-
"fontSize": 18,
472+
"fontSize": 16,
473473
"letterSpacing": 0,
474474
"lineHeight": 24,
475+
"textAlign": "center",
475476
}
476477
}
478+
testID="header-title"
477479
>
478480
Select token
479481
</Text>

app/components/UI/Bridge/components/BridgeNetworkSelectorBase.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
import React from 'react';
2-
import { ScrollView, StyleSheet } from 'react-native';
3-
import Text, {
4-
TextVariant,
5-
} from '../../../../component-library/components/Texts/Text';
2+
import { ScrollView } from 'react-native';
3+
64
import BottomSheetHeader from '../../../../component-library/components/BottomSheets/BottomSheetHeader';
75
import BottomSheet from '../../../../component-library/components/BottomSheets/BottomSheet';
86
import { strings } from '../../../../../locales/i18n';
97
import { ButtonIconSizes } from '../../../../component-library/components/Buttons/ButtonIcon';
108
import { useNavigation } from '@react-navigation/native';
119

12-
const styles = StyleSheet.create({
13-
headerTitle: {
14-
flex: 1,
15-
textAlign: 'center',
16-
},
17-
});
18-
1910
interface BridgeNetworkSelectorBaseProps {
2011
children: React.ReactNode;
2112
}
@@ -34,9 +25,7 @@ export const BridgeNetworkSelectorBase: React.FC<
3425
size: ButtonIconSizes.Lg,
3526
}}
3627
>
37-
<Text variant={TextVariant.HeadingMD} style={styles.headerTitle}>
38-
{strings('bridge.select_network')}
39-
</Text>
28+
{strings('bridge.select_network')}
4029
</BottomSheetHeader>
4130

4231
<ScrollView>{children}</ScrollView>

app/components/UI/Bridge/components/BridgeSourceNetworkSelector/__snapshots__/BridgeSourceNetworkSelector.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,14 +468,14 @@ exports[`BridgeSourceNetworkSelector renders with initial state and displays net
468468
style={
469469
{
470470
"color": "#121314",
471-
"flex": 1,
472471
"fontFamily": "Geist Bold",
473-
"fontSize": 18,
472+
"fontSize": 16,
474473
"letterSpacing": 0,
475474
"lineHeight": 24,
476475
"textAlign": "center",
477476
}
478477
}
478+
testID="header-title"
479479
>
480480
Select network
481481
</Text>

app/components/UI/Bridge/components/BridgeSourceTokenSelector/__snapshots__/BridgeSourceTokenSelector.test.tsx.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,13 @@ exports[`BridgeSourceTokenSelector renders with initial state and displays token
469469
{
470470
"color": "#121314",
471471
"fontFamily": "Geist Bold",
472-
"fontSize": 18,
472+
"fontSize": 16,
473473
"letterSpacing": 0,
474474
"lineHeight": 24,
475+
"textAlign": "center",
475476
}
476477
}
478+
testID="header-title"
477479
>
478480
Select token
479481
</Text>

app/components/UI/Bridge/components/BridgeTokenSelectorBase.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useCallback, useMemo, useRef } from 'react';
22
import { StyleSheet, View } from 'react-native';
33
import { Box } from '../../Box/Box';
44
import Text, {
5-
TextVariant,
65
TextColor,
76
} from '../../../../component-library/components/Texts/Text';
87
import { useStyles } from '../../../../component-library/hooks';
@@ -227,9 +226,7 @@ export const BridgeTokenSelectorBase: React.FC<
227226
size: ButtonIconSizes.Lg,
228227
}}
229228
>
230-
<Text variant={TextVariant.HeadingMD}>
231-
{title ?? strings('bridge.select_token')}
232-
</Text>
229+
{title ?? strings('bridge.select_token')}
233230
</BottomSheetHeader>
234231

235232
<Box style={styles.buttonContainer} gap={20}>

app/components/UI/Bridge/components/QuoteExpiredModal/QuoteExpiredModal.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ const QuoteExpiredModal = () => {
7272
return (
7373
<BottomSheet ref={sheetRef}>
7474
<BottomSheetHeader onClose={handleClose}>
75-
<Text variant={TextVariant.HeadingMD}>
76-
{strings('quote_expired_modal.title')}
77-
</Text>
75+
{strings('quote_expired_modal.title')}
7876
</BottomSheetHeader>
7977
<View style={styles.container}>
8078
<Text variant={TextVariant.BodyMD}>

app/components/UI/Bridge/components/QuoteExpiredModal/__snapshots__/QuoteExpiredModal.test.tsx.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,13 @@ exports[`QuoteExpiredModal renders correctly 1`] = `
168168
{
169169
"color": "#121314",
170170
"fontFamily": "Geist Bold",
171-
"fontSize": 18,
171+
"fontSize": 16,
172172
"letterSpacing": 0,
173173
"lineHeight": 24,
174+
"textAlign": "center",
174175
}
175176
}
177+
testID="header-title"
176178
>
177179
New quotes are available
178180
</Text>

app/components/UI/Bridge/components/SlippageModal/__snapshots__/SlippageModal.test.tsx.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,13 @@ exports[`SlippageModal renders all UI elements with the proper slippage options
168168
{
169169
"color": "#121314",
170170
"fontFamily": "Geist Bold",
171-
"fontSize": 18,
171+
"fontSize": 16,
172172
"letterSpacing": 0,
173173
"lineHeight": 24,
174+
"textAlign": "center",
174175
}
175176
}
177+
testID="header-title"
176178
>
177179
Slippage
178180
</Text>

0 commit comments

Comments
 (0)