From 1a811f6a8fa7d510c2c96a830a504de9196638ae Mon Sep 17 00:00:00 2001 From: Joao Paulo Costa Marra Date: Tue, 1 Sep 2026 13:21:37 -0300 Subject: [PATCH 1/2] Omit undefined optional props on AcceleratedCheckoutButtons Pass applePayLabel, applePayStyle, cornerRadius, and wallets to the native component only when they are defined, and omit height from the style until native reports a size, so undefined values are not serialized across the bridge where they can clobber kit defaults. --- .../components/AcceleratedCheckoutButtons.tsx | 14 +++++++----- .../tests/AcceleratedCheckoutButtons.test.tsx | 22 +++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/modules/@shopify/checkout-sheet-kit/src/components/AcceleratedCheckoutButtons.tsx b/modules/@shopify/checkout-sheet-kit/src/components/AcceleratedCheckoutButtons.tsx index 782af21e..b1ff81c3 100644 --- a/modules/@shopify/checkout-sheet-kit/src/components/AcceleratedCheckoutButtons.tsx +++ b/modules/@shopify/checkout-sheet-kit/src/components/AcceleratedCheckoutButtons.tsx @@ -304,12 +304,16 @@ export const AcceleratedCheckoutButtons: React.FC< return ( { expect(nativeComponent.props.cornerRadius).toBeUndefined(); }); + it('omits optional props when they are not provided', () => { + const {getByTestId} = render( + , + ); + + const nativeComponent = getByTestId('accelerated-checkout-buttons'); + expect(nativeComponent).toBeTruthy(); + expect(nativeComponent.props).not.toHaveProperty('applePayLabel'); + expect(nativeComponent.props).not.toHaveProperty('applePayStyle'); + expect(nativeComponent.props).not.toHaveProperty('cornerRadius'); + expect(nativeComponent.props).not.toHaveProperty('wallets'); + }); + + it('omits height from style until a size is reported', () => { + const {getByTestId} = render( + , + ); + + const nativeComponent = getByTestId('accelerated-checkout-buttons'); + expect(nativeComponent.props.style).toEqual({flex: 1}); + }); + it('passes through custom quantity and cornerRadius', () => { const {getByTestId} = render( Date: Tue, 1 Sep 2026 13:54:26 -0300 Subject: [PATCH 2/2] test: cover accelerated checkout apple pay label --- .../tests/AcceleratedCheckoutButtons.test.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/@shopify/checkout-sheet-kit/tests/AcceleratedCheckoutButtons.test.tsx b/modules/@shopify/checkout-sheet-kit/tests/AcceleratedCheckoutButtons.test.tsx index 214fd843..6ffdddd1 100644 --- a/modules/@shopify/checkout-sheet-kit/tests/AcceleratedCheckoutButtons.test.tsx +++ b/modules/@shopify/checkout-sheet-kit/tests/AcceleratedCheckoutButtons.test.tsx @@ -4,6 +4,7 @@ import {Platform} from 'react-native'; import { AcceleratedCheckoutButtons, AcceleratedCheckoutWallet, + ApplePayLabel, ApplePayStyle, RenderState, } from '../src'; @@ -98,6 +99,7 @@ describe('AcceleratedCheckoutButtons', () => { cartId={'gid://shopify/Cart/123'} cornerRadius={12} wallets={[AcceleratedCheckoutWallet.shopPay]} + applePayLabel={ApplePayLabel.buy} applePayStyle={ApplePayStyle.black} />, ); @@ -111,6 +113,7 @@ describe('AcceleratedCheckoutButtons', () => { expect(nativeComponent.props.wallets).toEqual([ AcceleratedCheckoutWallet.shopPay, ]); + expect(nativeComponent.props.applePayLabel).toBe(ApplePayLabel.buy); expect(nativeComponent.props.applePayStyle).toBe(ApplePayStyle.black); });