-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix(ramps): fix Transak checkout background color mismatch — native flow (TMCU-1087) #33310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
39922f2
abb86f3
ae524d9
ee7acd9
f256f7d
21e559a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,19 @@ | ||
| import { StyleSheet } from 'react-native'; | ||
| import { Theme } from '../../../../../util/theme/models'; | ||
| import { Theme, AppThemeKey } from '../../../../../util/theme/models'; | ||
| import { colors } from '../../../../../styles/common'; | ||
|
|
||
| const styleSheet = (params: { theme: Theme }) => | ||
| StyleSheet.create({ | ||
| const styleSheet = (params: { theme: Theme }) => { | ||
| const isDark = params.theme.themeAppearance === AppThemeKey.dark; | ||
| return StyleSheet.create({ | ||
| headerWithoutPadding: { | ||
| paddingVertical: 0, | ||
| }, | ||
| webview: { | ||
| backgroundColor: params.theme.colors.background.default, | ||
| backgroundColor: isDark | ||
| ? colors.transakBackgroundDark | ||
| : colors.transakBackgroundLight, | ||
|
cursor[bot] marked this conversation as resolved.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both the BottomSheet ( |
||
| }, | ||
| }); | ||
| }; | ||
|
|
||
| export default styleSheet; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,9 @@ import { | |
| } from '../../headless/headlessEntryNavigation'; | ||
| import { useStyles } from '../../../../hooks/useStyles'; | ||
| import styleSheet from './Checkout.styles'; | ||
| import { useTheme } from '../../../../../util/theme'; | ||
| import { AppThemeKey } from '../../../../../util/theme/models'; | ||
| import { colors } from '../../../../../styles/common'; | ||
| import Device from '../../../../../util/device'; | ||
| import { shouldStartLoadWithRequest } from '../../../../../util/browser'; | ||
| import { CHECKOUT_TEST_IDS } from './Checkout.testIds'; | ||
|
|
@@ -99,6 +102,14 @@ const Checkout = () => { | |
| const navigation = useNavigation(); | ||
| const params = useParams<CheckoutParams>(); | ||
| const { styles } = useStyles(styleSheet, {}); | ||
| const { themeAppearance } = useTheme(); | ||
| // Intentionally overrides the design-system BottomSheet background to match | ||
| // Transak's iframe, which we cannot style. Keeps the native chrome seamless | ||
| // with the embedded checkout flow. See colors.transak* in app/styles/common.ts. | ||
| const transakBgClassName = | ||
| themeAppearance === AppThemeKey.dark | ||
| ? `bg-[${colors.transakBackgroundDark}]` | ||
| : `bg-[${colors.transakBackgroundLight}]`; | ||
| const { addOrder, addPrecreatedOrder, getOrderFromCallback } = | ||
| useRampsOrders(); | ||
| const { trackEvent, createEventBuilder } = useAnalytics(); | ||
|
|
@@ -663,26 +674,22 @@ const Checkout = () => { | |
| keyboardAvoidingViewEnabled={false} | ||
| > | ||
| {sharedHeader} | ||
| <ScreenLayout> | ||
| <ScreenLayout.Body> | ||
| <ErrorView | ||
| description={error} | ||
| ctaOnPress={() => { | ||
| setKey((prevKey) => prevKey + 1); | ||
| setError(''); | ||
| isRedirectionHandledRef.current = false; | ||
| lastLoadCompleteUrlRef.current = null; | ||
| loadUrlErrorsRef.current.clear(); | ||
| loadStartTimeRef.current = null; | ||
| closeSourceRef.current = null; | ||
| urlHistoryRef.current = { current: null, previous: null }; | ||
| stepIndexRef.current = 0; | ||
| previousNavStateUrlRef.current = null; | ||
| }} | ||
| location="Provider Webview" | ||
| /> | ||
| </ScreenLayout.Body> | ||
| </ScreenLayout> | ||
| <ErrorView | ||
| description={error} | ||
| ctaOnPress={() => { | ||
| setKey((prevKey) => prevKey + 1); | ||
| setError(''); | ||
| isRedirectionHandledRef.current = false; | ||
| lastLoadCompleteUrlRef.current = null; | ||
| loadUrlErrorsRef.current.clear(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Before / After |
||
| loadStartTimeRef.current = null; | ||
| closeSourceRef.current = null; | ||
| urlHistoryRef.current = { current: null, previous: null }; | ||
| stepIndexRef.current = 0; | ||
| previousNavStateUrlRef.current = null; | ||
| }} | ||
| location="Provider Webview" | ||
| /> | ||
| </BottomSheet> | ||
| ); | ||
| } | ||
|
|
@@ -695,6 +702,7 @@ const Checkout = () => { | |
| isFullscreen | ||
| isInteractable={!Device.isAndroid()} | ||
| keyboardAvoidingViewEnabled={false} | ||
| twClassName={transakBgClassName} | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| > | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only the WebView BottomSheet gets the Transak background override — the error state intentionally keeps the default design-system surface ( |
||
| {sharedHeader} | ||
| <WebView | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,11 @@ export const colors = { | |
| gettingStartedPageBackgroundColor: '#EAC2FF', | ||
| gettingStartedTextColor: '#3D065F', | ||
| gettingStartedPageBackgroundColorLightMode: '#FFF2EB', | ||
| // Transak's iframe renders these background colors — values are set by Transak | ||
| // and outside our control. Used to match the BottomSheet surface so the | ||
| // checkout feels seamless. Update only if Transak changes their theme colors. | ||
| transakBackgroundDark: '#1a1a1a', | ||
| transakBackgroundLight: '#ffffff', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }; | ||
|
|
||
| export const onboardingCarouselColors: Record< | ||
|
|
||




Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every call site renders
ErrorViewinside a container that already owns the surface color — either aBottomSheetor aScreenLayout. HavingErrorViewalso paint a background caused a visual conflict in pure-black mode where the container surface (bg-alternative) differed fromcolors.background.default. Making the component transparent keeps the responsibility with the container.Before / After