Skip to content

Commit 35277d6

Browse files
fix(ramps): fix Transak checkout background color mismatch — aggregator flow (TMCU-1087)
Mirrors the fix from the native unified-buy flow to the legacy aggregator checkout. Overrides the component-library BottomSheet background (via the style prop, which is spread last into the sheet surface) and the WebView backgroundColor to match Transak's iframe theme colors (#1a1a1a dark / #ffffff light), sourced from new constants in app/styles/common.ts. Also removes the hardcoded backgroundColor from ErrorView so the container (BottomSheet or ScreenLayout) is always responsible for the surface color.
1 parent 955fd0a commit 35277d6

4 files changed

Lines changed: 28 additions & 5 deletions

File tree

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import { StyleSheet } from 'react-native';
2-
import { Theme } from '../../../../../../util/theme/models';
2+
import { Theme, AppThemeKey } from '../../../../../../util/theme/models';
3+
import { colors } from '../../../../../../styles/common';
34

4-
const styleSheet = (params: { theme: Theme }) =>
5-
StyleSheet.create({
5+
const styleSheet = (params: { theme: Theme }) => {
6+
const isDark = params.theme.themeAppearance === AppThemeKey.dark;
7+
return StyleSheet.create({
68
headerWithoutPadding: {
79
paddingVertical: 0,
810
},
911
webview: {
10-
backgroundColor: params.theme.colors.background.default,
12+
backgroundColor: isDark
13+
? colors.transakBackgroundDark
14+
: colors.transakBackgroundLight,
1115
},
1216
});
17+
};
1318

1419
export default styleSheet;

app/components/UI/Ramp/Aggregator/Views/Checkout/Checkout.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ import {
3838
} from '../../../../../../component-library/components/Icons/Icon';
3939
import { useStyles } from '../../../../../../component-library/hooks';
4040
import styleSheet from './Checkout.styles';
41+
import { useTheme } from '../../../../../../util/theme';
42+
import { AppThemeKey } from '../../../../../../util/theme/models';
43+
import { colors } from '../../../../../../styles/common';
4144
import Device from '../../../../../../util/device';
4245
import { shouldStartLoadWithRequest } from '../../../../../../util/browser';
4346
import { CHECKOUT_TEST_IDS } from './Checkout.testIds';
@@ -67,6 +70,16 @@ const CheckoutWebView = () => {
6770
const handleSuccessfulOrder = useHandleSuccessfulOrder();
6871

6972
const { styles } = useStyles(styleSheet, {});
73+
const { themeAppearance } = useTheme();
74+
// Intentionally overrides the design-system BottomSheet background to match
75+
// Transak's iframe, which we cannot style. Keeps the native chrome seamless
76+
// with the embedded checkout flow. See colors.transak* in app/styles/common.ts.
77+
const transakBgStyle = {
78+
backgroundColor:
79+
themeAppearance === AppThemeKey.dark
80+
? colors.transakBackgroundDark
81+
: colors.transakBackgroundLight,
82+
};
7083

7184
const { url: uri, customOrderId, provider } = params;
7285

@@ -252,6 +265,7 @@ const CheckoutWebView = () => {
252265
isFullscreen
253266
isInteractable={!Device.isAndroid()}
254267
keyboardAvoidingViewEnabled={false}
268+
style={transakBgStyle}
255269
>
256270
<BottomSheetHeader
257271
endAccessory={

app/components/UI/Ramp/Aggregator/components/ErrorView.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const createStyles = (
2828
flex: options?.asScreen ? 1 : undefined,
2929
justifyContent: 'center',
3030
alignItems: 'center',
31-
backgroundColor: colors.background.default,
3231
},
3332
content: {
3433
width: '100%',

app/styles/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ export const colors = {
2727
gettingStartedPageBackgroundColor: '#EAC2FF',
2828
gettingStartedTextColor: '#3D065F',
2929
gettingStartedPageBackgroundColorLightMode: '#FFF2EB',
30+
// Transak's iframe renders these background colors — values are set by Transak
31+
// and outside our control. Used to match the BottomSheet surface so the
32+
// checkout feels seamless. Update only if Transak changes their theme colors.
33+
transakBackgroundDark: '#1a1a1a',
34+
transakBackgroundLight: '#ffffff',
3035
};
3136

3237
export const onboardingCarouselColors: Record<

0 commit comments

Comments
 (0)