diff --git a/app/components/Views/confirmations/components/confirm/confirm-component.styles.test.ts b/app/components/Views/confirmations/components/confirm/confirm-component.styles.test.ts new file mode 100644 index 00000000000..d462d54588d --- /dev/null +++ b/app/components/Views/confirmations/components/confirm/confirm-component.styles.test.ts @@ -0,0 +1,42 @@ +import { brandColor, darkTheme } from '@metamask/design-tokens'; +import { AppThemeKey, Theme } from '../../../../../util/theme/models'; + +const MOCK_ELEVATED_SURFACE_COLOR = 'mock-elevated-surface-color'; + +jest.mock('../../../../../util/theme/themeUtils', () => ({ + getElevatedSurfaceColor: jest.fn(() => MOCK_ELEVATED_SURFACE_COLOR), +})); + +import styleSheet from './confirm-component.styles'; + +const darkThemeModel: Theme = { + colors: darkTheme.colors, + themeAppearance: AppThemeKey.dark, + typography: darkTheme.typography, + shadows: darkTheme.shadows, + brandColors: brandColor, +}; + +describe('confirm-component.styles', () => { + it('uses elevated surface color for the full-screen flat container', () => { + const styles = styleSheet({ + theme: darkThemeModel, + vars: { isFullScreenConfirmation: true }, + }); + + expect(styles.flatContainer.backgroundColor).toBe( + MOCK_ELEVATED_SURFACE_COLOR, + ); + }); + + it('uses elevated surface color for the default loader spinner container', () => { + const styles = styleSheet({ + theme: darkThemeModel, + vars: { isFullScreenConfirmation: true }, + }); + + expect(styles.spinnerContainer.backgroundColor).toBe( + MOCK_ELEVATED_SURFACE_COLOR, + ); + }); +}); diff --git a/app/components/Views/confirmations/components/confirm/confirm-component.styles.ts b/app/components/Views/confirmations/components/confirm/confirm-component.styles.ts index 879203aed1c..509fffaaf70 100644 --- a/app/components/Views/confirmations/components/confirm/confirm-component.styles.ts +++ b/app/components/Views/confirmations/components/confirm/confirm-component.styles.ts @@ -1,5 +1,6 @@ import { StyleSheet } from 'react-native'; import { Theme } from '../../../../../util/theme/models'; +import { getElevatedSurfaceColor } from '../../../../../util/theme/themeUtils'; const styleSheet = (params: { theme: Theme; @@ -11,9 +12,6 @@ const styleSheet = (params: { const { theme, vars } = params; return StyleSheet.create({ - bottomSheetDialogSheet: { - backgroundColor: theme.colors.background.default, - }, confirmContainer: { display: 'flex', maxHeight: '100%', @@ -21,7 +19,8 @@ const styleSheet = (params: { flatContainer: { flex: 1, zIndex: 9999, - backgroundColor: theme.colors.background.default, + // TODO(Pure Black): Remove once MMDS ships pure-black-aware surface tokens. + backgroundColor: getElevatedSurfaceColor(theme), justifyContent: 'space-between', }, scrollView: { @@ -31,7 +30,8 @@ const styleSheet = (params: { flexGrow: vars.isFullScreenConfirmation ? 1 : undefined, }, spinnerContainer: { - backgroundColor: theme.colors.background.default, + // TODO(Pure Black): Remove once MMDS ships pure-black-aware surface tokens. + backgroundColor: getElevatedSurfaceColor(theme), width: '100%', height: '100%', justifyContent: 'center', diff --git a/app/components/Views/confirmations/components/confirm/confirm-component.tsx b/app/components/Views/confirmations/components/confirm/confirm-component.tsx index ca1cbc1c892..3c8b0cdf7f7 100755 --- a/app/components/Views/confirmations/components/confirm/confirm-component.tsx +++ b/app/components/Views/confirmations/components/confirm/confirm-component.tsx @@ -186,7 +186,6 @@ export const Confirm = ({ onReject()} shouldNavigateBack={false} - style={styles.bottomSheetDialogSheet} testID={ConfirmationUIType.MODAL} >