Skip to content

Clip checkout sheet content to rounded top corners#391

Open
kiftio wants to merge 1 commit into
06-30-allow_customizationfrom
07-01-clip_checkout_sheet_content_to_rounded_top_corners
Open

Clip checkout sheet content to rounded top corners#391
kiftio wants to merge 1 commit into
06-30-allow_customizationfrom
07-01-clip_checkout_sheet_content_to_rounded_top_corners

Conversation

@kiftio

@kiftio kiftio commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

Fixes square child surfaces (e.g. the WebView background) visually leaking outside the rounded top corners of the checkout bottom sheet. Previously, only the header toolbar had rounded top corners applied via its background drawable, but child views could still render with square corners that were visible at the sheet edges.

To address this, CheckoutBottomSheetLayout now overrides draw() to clip its canvas to a rounded-top-corner path matching the configured cornerRadiusDp. The corner radius is converted to pixels once in CheckoutBottomSheet and shared between the header drawable and the new topCornerRadiusPx property on CheckoutBottomSheetLayout.

Additionally, settleExpanded() has been refactored into a top-level extension function animateExpanded() on View, making it reusable across the gesture handling paths where it was previously duplicated.

How to test

  1. Configure a non-zero cornerRadiusDp via CheckoutSheetStyle (e.g. 18f).
  2. Present the checkout bottom sheet.
  3. Verify that the top corners of the sheet are visually rounded, with no square WebView or container background bleeding through at the edges.
  4. Drag the sheet partially down and release (or cancel) — confirm it animates back to the expanded position correctly.

Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Embedded Checkout Protocol version?
  • I have bumped embeddedCheckoutProtocolAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated protocol/languages/kotlin/embedded-checkout-protocol/api/embedded-checkout-protocol.api if the public API changed
Releasing a new Android version?
  • I have bumped checkoutKitAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

@github-actions github-actions Bot added the #gsd:50662 Rebase Checkout Kit on UCP label Jul 1, 2026

kiftio commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kiftio kiftio force-pushed the 07-01-clip_checkout_sheet_content_to_rounded_top_corners branch from afa89d8 to 246f5ba Compare July 2, 2026 08:10
@kiftio kiftio force-pushed the 06-30-allow_customization branch from 8d13f41 to 99b2d1c Compare July 3, 2026 20:16
@kiftio kiftio force-pushed the 07-01-clip_checkout_sheet_content_to_rounded_top_corners branch 2 times, most recently from 62c238d to e1cb2aa Compare July 3, 2026 21:05
@kiftio kiftio force-pushed the 06-30-allow_customization branch from 99b2d1c to de950ef Compare July 3, 2026 21:05
@kiftio kiftio force-pushed the 07-01-clip_checkout_sheet_content_to_rounded_top_corners branch from e1cb2aa to 15347cc Compare July 3, 2026 21:22
@kiftio kiftio force-pushed the 06-30-allow_customization branch 2 times, most recently from f000a91 to 90d60c5 Compare July 6, 2026 08:34
@kiftio kiftio force-pushed the 07-01-clip_checkout_sheet_content_to_rounded_top_corners branch from 15347cc to f55f940 Compare July 6, 2026 08:34
@kiftio kiftio force-pushed the 06-30-allow_customization branch from 90d60c5 to 429d910 Compare July 6, 2026 08:55
@kiftio kiftio force-pushed the 07-01-clip_checkout_sheet_content_to_rounded_top_corners branch from f55f940 to 4a40d2c Compare July 6, 2026 08:55
@kiftio kiftio force-pushed the 06-30-allow_customization branch from 429d910 to 9578921 Compare July 6, 2026 08:58
@kiftio kiftio force-pushed the 07-01-clip_checkout_sheet_content_to_rounded_top_corners branch from 4a40d2c to c098f51 Compare July 6, 2026 08:58
@RunWith(RobolectricTestRunner::class)
class CheckoutBottomSheetStyleTest {

private lateinit var activityController: ActivityController<ComponentActivity>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensuring resources are cleared up at the end of tests

private const val TEST_SHEET_SIZE = 1000
private const val TEST_SHEET_HEADER_SIZE = 120
private const val MATERIAL_COMPONENTS_SCRIM_COLOR = 0x52000000
private const val LEGACY_LIGHT_BACKGROUND_NAVIGATION_BAR_COLOR = 0x52000000

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on Android versions before O/API 26, apps cannot request dark navigation bar buttons. If the checkout background is light, transparent nav bar + light buttons can have poor contrast. So the code uses this semi-transparent black nav bar color on legacy
Android to preserve contrast.

private val Window.isAppearanceLightNavigationBars: Boolean
get() = WindowCompat.getInsetsController(this, decorView).isAppearanceLightNavigationBars

private class RecordingCheckoutListener : DefaultCheckoutListener() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allows us to prevent mocking a static

}
}
shadowOf(activity.packageManager).addResolveInfoForIntent(intent, resolveInfo)
shadowOf(activity.packageManager).setResolveInfosForIntent(intent, listOf(resolveInfo))

@kiftio kiftio Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoids deprecation warning during the build

}
}
shadowOf(activity.packageManager).addResolveInfoForIntent(intent, resolveInfo)
shadowOf(activity.packageManager).setResolveInfosForIntent(intent, listOf(resolveInfo))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoids deprecation warning during the build

@kiftio kiftio marked this pull request as ready for review July 6, 2026 09:05
@kiftio kiftio requested a review from a team as a code owner July 6, 2026 09:05
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 92%
91.85% (327/356) 87.98% (183/208) 100% (86/86)

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Package Size

Platform Artifact Base Head Delta
Android release AAR 199.7 KiB 201.6 KiB +1.9 KiB
Android file breakdown
File Base Head Delta
classes.jar 210.9 KiB 212.9 KiB +2.1 KiB
res/layout/checkout_sheet_content.xml 4.0 KiB 4.0 KiB 0 B
res/values/values.xml 1.2 KiB 1.2 KiB 0 B
R.txt 1.0 KiB 1.0 KiB 0 B
proguard.txt 798 B 798 B 0 B
AndroidManifest.xml 578 B 578 B 0 B
res/drawable/close.xml 431 B 431 B 0 B
res/menu/checkout_menu.xml 354 B 354 B 0 B
META-INF/com/android/build/gradle/aar-metadata.properties 157 B 157 B 0 B

Measured from the PR base SHA and PR head SHA. The file breakdown shows uncompressed sizes within each package artifact, so individual files do not sum to the compressed artifact total. This comment reports package artifact sizes only; it is not a final app binary-size report.

@kiftio kiftio force-pushed the 06-30-allow_customization branch from 9578921 to 4252bcb Compare July 6, 2026 09:14
@kiftio kiftio force-pushed the 07-01-clip_checkout_sheet_content_to_rounded_top_corners branch from c098f51 to 15323c3 Compare July 6, 2026 09:14
@kiftio kiftio force-pushed the 06-30-allow_customization branch from 4252bcb to d60c4c5 Compare July 6, 2026 09:20
@kiftio kiftio force-pushed the 07-01-clip_checkout_sheet_content_to_rounded_top_corners branch from 15323c3 to 41afb6b Compare July 6, 2026 09:20
@kiftio kiftio force-pushed the 07-01-clip_checkout_sheet_content_to_rounded_top_corners branch 2 times, most recently from 21b2781 to c7e2b9e Compare July 6, 2026 12:37
@kiftio kiftio force-pushed the 06-30-allow_customization branch from d60c4c5 to 6a324dc Compare July 6, 2026 12:37
Assisted-By: devx/6db0ff39-6d19-4074-ab7f-a027dc8b067f
@kiftio kiftio force-pushed the 06-30-allow_customization branch from 6a324dc to 7fcd2f0 Compare July 6, 2026 13:12
@kiftio kiftio force-pushed the 07-01-clip_checkout_sheet_content_to_rounded_top_corners branch from c7e2b9e to 9c116eb Compare July 6, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant