Skip to content

Commit 3741758

Browse files
fix(bridge): remove redundant useElevatedSurface from Bridge modals
MMDS BottomSheet now handles pure-black elevated surface internally. Remove the useElevatedSurface shim (twClassName={surfaceClass}) from all Bridge-owned bottom sheet modals per TMCU-1039. Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
1 parent 480b6e4 commit 3741758

8 files changed

Lines changed: 1 addition & 24 deletions

File tree

app/components/UI/Bridge/components/BatchSellDestinationTokenSelectorModal/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import { RootState } from '../../../../../reducers';
3636
import { BridgeToken } from '../../types';
3737
import { formatTokenBalance } from '../../utils';
3838
import { BatchSellDestinationTokenSelectorModalSelectorsIDs } from './BatchSellDestinationTokenSelectorModal.testIds';
39-
import { useElevatedSurface } from '../../../../../util/theme/themeUtils';
4039

4140
const getTokenKey = (token: BridgeToken) => `${token.chainId}:${token.address}`;
4241

@@ -87,7 +86,6 @@ export function BatchSellDestinationTokenSelectorModal() {
8786
chainIds:
8887
destinationChainIds ?? (sourceChainId ? [sourceChainId] : undefined),
8988
});
90-
const surfaceClass = useElevatedSurface();
9189

9290
const handleClose = useCallback(() => {
9391
sheetRef.current?.onCloseBottomSheet();
@@ -106,7 +104,6 @@ export function BatchSellDestinationTokenSelectorModal() {
106104
ref={sheetRef}
107105
goBack={navigation.goBack}
108106
testID={BatchSellDestinationTokenSelectorModalSelectorsIDs.SHEET}
109-
twClassName={surfaceClass}
110107
>
111108
<BottomSheetHeader
112109
onClose={handleClose}

app/components/UI/Bridge/components/BatchSellFinalReviewModal/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import { useSubmitBatchSellTx } from '../../hooks/useSubmitBatchSellTx';
4848
import type { BridgeToken } from '../../types';
4949
import { BatchSellQuoteDetails } from '../BatchSellQuoteDetailsModal';
5050
import { BatchSellFinalReviewModalSelectorsIDs } from './BatchSellFinalReviewModal.testIds';
51-
import { useElevatedSurface } from '../../../../../util/theme/themeUtils';
5251
import { useTrackBatchSellReviewModalSubmitted } from '../../hooks/useTrackBatchSellReviewModalSubmitted';
5352

5453
const MAX_VISIBLE_SOURCE_TOKEN_AVATARS = 5;
@@ -305,7 +304,6 @@ export function BatchSellFinalReviewModal() {
305304
isGasless: batchSellQuoteData.isGasless,
306305
networkFee: batchSellQuoteData.networkFee,
307306
});
308-
const surfaceClass = useElevatedSurface();
309307
const sheetRef = useRef<BottomSheetRef>(null);
310308
const [isTokenDetailsExpanded, setIsTokenDetailsExpanded] = useState(false);
311309
const trackBatchSellReviewModalSubmitted =
@@ -433,7 +431,6 @@ export function BatchSellFinalReviewModal() {
433431
ref={sheetRef}
434432
testID={BatchSellFinalReviewModalSelectorsIDs.SHEET}
435433
goBack={navigation.goBack}
436-
twClassName={surfaceClass}
437434
>
438435
<BottomSheetHeader
439436
onClose={handleClose}

app/components/UI/Bridge/components/BatchSellMinimumReceivedInfoModal/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,18 @@ import { strings } from '../../../../../../locales/i18n';
1515
import { useParams } from '../../../../../util/navigation/navUtils';
1616
import { BatchSellMinimumReceivedInfoModalSelectorsIDs } from './BatchSellMinimumReceivedInfoModal.testIds';
1717
import { BatchSellMinimumReceivedInfoModalParams } from './BatchSellMinimumReceivedInfoModal.types';
18-
import { useElevatedSurface } from '../../../../../util/theme/themeUtils';
1918

2019
export function BatchSellMinimumReceivedInfoModal() {
2120
const navigation = useNavigation<AppStackNavigationProp>();
2221
const { sourceModal } = useParams<BatchSellMinimumReceivedInfoModalParams>();
2322
const handleBack = sourceModal
2423
? () => navigation.replace(sourceModal.screen, sourceModal.params)
2524
: undefined;
26-
const surfaceClass = useElevatedSurface();
2725

2826
return (
2927
<BottomSheet
3028
testID={BatchSellMinimumReceivedInfoModalSelectorsIDs.SHEET}
3129
goBack={navigation.goBack}
32-
twClassName={surfaceClass}
3330
>
3431
<BottomSheetHeader
3532
onBack={handleBack}

app/components/UI/Bridge/components/BatchSellNetworkFeeInfoModal/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,18 @@ import { strings } from '../../../../../../locales/i18n';
1515
import { useParams } from '../../../../../util/navigation/navUtils';
1616
import { BatchSellNetworkFeeInfoModalSelectorsIDs } from './BatchSellNetworkFeeInfoModal.testIds';
1717
import { BatchSellNetworkFeeInfoModalParams } from './BatchSellNetworkFeeInfoModal.types';
18-
import { useElevatedSurface } from '../../../../../util/theme/themeUtils';
1918

2019
export function BatchSellNetworkFeeInfoModal() {
2120
const navigation = useNavigation<AppStackNavigationProp>();
2221
const { sourceModal } = useParams<BatchSellNetworkFeeInfoModalParams>();
2322
const handleBack = sourceModal
2423
? () => navigation.replace(sourceModal.screen, sourceModal.params)
2524
: undefined;
26-
const surfaceClass = useElevatedSurface();
2725

2826
return (
2927
<BottomSheet
3028
testID={BatchSellNetworkFeeInfoModalSelectorsIDs.SHEET}
3129
goBack={navigation.goBack}
32-
twClassName={surfaceClass}
3330
>
3431
<BottomSheetHeader
3532
onBack={handleBack}

app/components/UI/Bridge/components/BatchSellQuoteDetailsModal/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ import {
1717
import { BatchSellQuoteDetails } from './BatchSellQuoteDetails';
1818
import { BatchSellQuoteDetailsModalSelectorsIDs } from './BatchSellQuoteDetailsModal.testIds';
1919
import { strings } from '../../../../../../locales/i18n';
20-
import { useElevatedSurface } from '../../../../../util/theme/themeUtils';
2120

2221
export function BatchSellQuoteDetailsModal() {
2322
const navigation = useNavigation<AppStackNavigationProp>();
2423
const sourceTokens = useSelector(selectBatchSellSourceTokens);
25-
const surfaceClass = useElevatedSurface();
2624
const batchSellQuoteData = useBatchSellQuoteData({
2725
shouldUpdateBatchSellTrades: false,
2826
});
@@ -49,7 +47,6 @@ export function BatchSellQuoteDetailsModal() {
4947
<BottomSheet
5048
testID={BatchSellQuoteDetailsModalSelectorsIDs.SHEET}
5149
goBack={navigation.goBack}
52-
twClassName={surfaceClass}
5350
>
5451
<BottomSheetHeader
5552
onClose={navigation.goBack}

app/components/UI/Bridge/components/HighRateAlertModal/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
useSwapBridgeNavigation,
2020
} from '../../hooks/useSwapBridgeNavigation';
2121
import { HighRateAlertModalSelectorsIDs } from './HighRateAlertModal.testIds';
22-
import { useElevatedSurface } from '../../../../../util/theme/themeUtils';
2322

2423
export interface HighRateAlertModalParams {
2524
sourceToken: BridgeToken;
@@ -34,7 +33,6 @@ export function HighRateAlertModal() {
3433
location: SwapBridgeNavigationLocation.MainView,
3534
sourcePage: 'BatchSell',
3635
});
37-
const surfaceClass = useElevatedSurface();
3836

3937
const handleClose = useCallback(() => {
4038
sheetRef.current?.onCloseBottomSheet();
@@ -51,7 +49,6 @@ export function HighRateAlertModal() {
5149
ref={sheetRef}
5250
goBack={goBack}
5351
testID={HighRateAlertModalSelectorsIDs.SHEET}
54-
twClassName={surfaceClass}
5552
>
5653
<BottomSheetHeader
5754
onClose={handleClose}

app/components/UI/Bridge/components/MissingPriceModal/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
Text,
2626
TextVariant,
2727
} from '@metamask/design-system-react-native';
28-
import { useElevatedSurface } from '../../../../../util/theme/themeUtils';
2928

3029
export interface MissingPriceModalParams {
3130
location: MetaMetricsSwapsEventSource;
@@ -36,7 +35,6 @@ export const MissingPriceModal = () => {
3635
const sheetRef = useRef<BottomSheetRef>(null);
3736
const [loading, setLoading] = useState(false);
3837
const { location } = useParams<MissingPriceModalParams>();
39-
const surfaceClass = useElevatedSurface();
4038
const sourceToken = useSelector(selectSourceToken);
4139
const tokenBalance = useLatestBalance({
4240
address: sourceToken?.address,
@@ -69,7 +67,6 @@ export const MissingPriceModal = () => {
6967
<BottomSheet
7068
ref={sheetRef}
7169
goBack={navigation.goBack}
72-
twClassName={surfaceClass}
7370
>
7471
<BottomSheetHeader
7572
onClose={handleClose}

app/components/UI/Bridge/components/PriceImpactModal/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
BottomSheet,
2020
BottomSheetRef,
2121
} from '@metamask/design-system-react-native';
22-
import { useElevatedSurface } from '../../../../../util/theme/themeUtils';
2322

2423
export const PriceImpactModal = () => {
2524
const { goBack } = useNavigation();
@@ -43,7 +42,6 @@ export const PriceImpactModal = () => {
4342
const priceImpactViewData = usePriceImpactViewData(
4443
activeQuote?.quote.priceData?.priceImpact,
4544
);
46-
const surfaceClass = useElevatedSurface();
4745

4846
const isDangerousPriceImpact = useMemo(
4947
() =>
@@ -68,7 +66,7 @@ export const PriceImpactModal = () => {
6866
}, [confirmBridge]);
6967

7068
return (
71-
<BottomSheet ref={sheetRef} goBack={goBack} twClassName={surfaceClass}>
69+
<BottomSheet ref={sheetRef} goBack={goBack}>
7270
<PriceImpactHeader
7371
onClose={handleClose}
7472
iconName={priceImpactViewData.icon?.name}

0 commit comments

Comments
 (0)