Skip to content

Commit a5f02aa

Browse files
fix: preserve sample checkout color overrides (#482)
### What changes are you making? Fixes the React Native sample app configuration so custom checkout color overrides are preserved when building the final Checkout Sheet Kit config. This also updates Metro resolution so the sample app resolves the local package source when testing workspace changes. ANDROID [Screen Recording 2026-05-06 at 9.16.04 AM.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.com/user-attachments/thumbnails/12f47d81-ed84-4fbd-9be8-7115110f6ef8.mov" />](https://app.graphite.com/user-attachments/video/12f47d81-ed84-4fbd-9be8-7115110f6ef8.mov) iOS [Screen Recording 2026-05-06 at 9.21.08 AM.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.com/user-attachments/thumbnails/847655f4-227d-42b1-9157-67d49bde7d0b.mov" />](https://app.graphite.com/user-attachments/video/847655f4-227d-42b1-9157-67d49bde7d0b.mov)
1 parent a3ed0f2 commit a5f02aa

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

metro.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ const config = mergeConfig(getDefaultConfig(__dirname), {
1616
watchFolders: [root],
1717

1818
resolver: {
19+
resolveRequest: (context, moduleName, platform) => {
20+
if (
21+
moduleName === '@shopify/checkout-sheet-kit' ||
22+
moduleName.startsWith('@shopify/checkout-sheet-kit/')
23+
) {
24+
const sub = moduleName.replace('@shopify/checkout-sheet-kit', '');
25+
const target = path.resolve(
26+
root,
27+
'modules',
28+
'@shopify/checkout-sheet-kit',
29+
'src',
30+
sub ? sub.replace(/^\//, '') : 'index.ts',
31+
);
32+
return {type: 'sourceFile', filePath: target};
33+
}
34+
return context.resolveRequest(context, moduleName, platform);
35+
},
1936
extraNodeModules: {
2037
react: path.resolve(sample, 'node_modules', 'react'),
2138
'react-native': path.resolve(sample, 'node_modules', 'react-native'),

sample/src/App.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,20 @@ function AppWithCheckoutKit({children}: PropsWithChildren) {
406406
return {
407407
...checkoutKitConfigDefaults,
408408
...checkoutKitThemeConfig,
409+
colors: {
410+
...checkoutKitThemeConfig.colors,
411+
ios: {
412+
...checkoutKitThemeConfig.colors?.ios,
413+
...checkoutKitConfigDefaults.colors?.ios,
414+
},
415+
android:
416+
appConfig.colorScheme === ColorScheme.automatic
417+
? checkoutKitThemeConfig.colors?.android
418+
: {
419+
...checkoutKitThemeConfig.colors?.android,
420+
...checkoutKitConfigDefaults.colors?.android,
421+
},
422+
},
409423
acceleratedCheckouts: {
410424
storefrontDomain: env.STOREFRONT_DOMAIN!,
411425
storefrontAccessToken: env.STOREFRONT_ACCESS_TOKEN!,

0 commit comments

Comments
 (0)