Skip to content

Fix AcceleratedCheckoutButtons touch area in bounded-height parents - #548

Draft
kyle-schellen wants to merge 1 commit into
mainfrom
ks/accelerated-checkout-buttons-height
Draft

kyle-schellen wants to merge 1 commit into
mainfrom
ks/accelerated-checkout-buttons-height

Conversation

@kyle-schellen

@kyle-schellen kyle-schellen commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What changes are you making?

AcceleratedCheckoutButtons can end up with a touch area smaller than the buttons it draws, so taps near the top or bottom edge of the buttons do nothing.

The native view reports its height (48 pt per wallet, plus 8 pt between wallets), and the component applies it as height. It also applied flex: 1, which gives the view a flex basis of 0. When the parent's height is bounded, React Native lays the view out from that basis instead of height. For example, a View with only minHeight: 48 outside a ScrollView does this. The view ends up shorter than the buttons, and touches outside it never reach them.

This replaces flex: 1 with flexGrow: 1, so the view is sized from the reported height and matches the buttons.

Review focus

  • flexGrow: 1 is what keeps the buttons full width in a flexDirection: 'row' parent. Without any flex style, they collapse to zero width there.
  • In a parent with a fixed height shorter than the buttons, the view keeps the reported height and overflows the parent.

How to test

On an iOS 16+ simulator, with an item in the cart:

  1. In sample/src/screens/CartScreen.tsx, move the Apple Pay and Shop Pay AcceleratedCheckoutButtons below the ScrollView and wrap them in a View with style={{minHeight: 48}}. Show the wrapper's onLayout height and an onTouchStart count on screen.
  2. Tap just inside the top edge of Apple Pay and just inside the bottom edge of Shop Pay.
    • On main, the wrapper is 48 tall and neither tap is counted.
    • With this change, the wrapper is 104 tall and both taps are counted.
  3. Change the wrapper's style to {flexDirection: 'row'}. With this change, the buttons are full width and both taps are counted.

The existing height test expects flexGrow: 1, and fails against main.

I ran pnpm test (123 passed), pnpm module lint and pnpm sample lint, plus the steps above on iOS 18.6 and iOS 26.2 simulators.


PR Checklist

Important

Releasing a new version of the kit?

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Coverage Report

Lines Statements Branches Functions
Coverage: 99%
99.12% (227/229) 94.61% (123/130) 100% (67/67)

@kyle-schellen kyle-schellen self-assigned this Oct 20, 2026
`flex: 1` gives the view a flex basis of 0. When the parent's height is
bounded, React Native lays the view out from that basis instead of the
height reported by the native view, so the view is shorter than the
buttons it draws and taps outside it are dropped.

Use `flexGrow: 1` so the view is sized from the reported height while
still filling row and taller parents.
@kyle-schellen
kyle-schellen force-pushed the ks/accelerated-checkout-buttons-height branch from 962fc21 to 17d07ed Compare October 20, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant