Skip to content

[Android] Allow sheet customization#382

Open
kiftio wants to merge 1 commit into
dk/custom-bottom-sheetfrom
06-30-allow_customization
Open

[Android] Allow sheet customization#382
kiftio wants to merge 1 commit into
dk/custom-bottom-sheetfrom
06-30-allow_customization

Conversation

@kiftio

@kiftio kiftio commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

Introduces CheckoutSheetStyle, a new configuration type that decouples native sheet chrome styling from ColorScheme. Previously, properties like closeIcon and closeIconTint were embedded in color scheme definitions, making it awkward to style sheet chrome independently of checkout colors.

CheckoutSheetStyle exposes the following properties:

  • cornerRadiusDp — controls the top corner radius of the sheet header (defaults to 32f)
  • titleAlignment — aligns the sheet title to START or CENTER (defaults to CENTER)
  • toolbarElevationDp — sets the toolbar shadow elevation (defaults to 0f)
  • closeIcon — optional custom close button drawable
  • closeIconTint — optional tint applied to the default close icon

closeIcon and closeIconTint are moved out of ColorScheme/Colors and into CheckoutSheetStyle. The closeIcon takes precedence over closeIconTint when both are set. The hardcoded checkout_sheet_corner_radius dimension resource is removed in favour of the runtime value from CheckoutSheetStyle.

Configuration gains a sheetStyle field (defaulting to CheckoutSheetStyle()) alongside colorScheme. The demo app's settings screen is updated with a CheckoutSheetStyleSection that lets users switch between a NewDefaults preset and a LegacyDialog preset (square corners, start-aligned title, elevated toolbar), persisted via DataStore.

How to test

  1. Configure sheetStyle in your app:
    ShopifyCheckoutKit.configure {
        it.sheetStyle = CheckoutSheetStyle(
            cornerRadiusDp = 32f,
            titleAlignment = CheckoutSheetTitleAlignment.CENTER,
            toolbarElevationDp = 0f,
            closeIconTint = Color.ResourceId(R.color.checkout_close),
        )
    }
  2. Present checkout and verify the sheet header reflects the configured corner radius, title alignment, toolbar elevation, and close icon styling.
  3. Switch to the LegacyDialog preset in the demo app settings and confirm the sheet renders with square corners, a start-aligned title, and visible toolbar elevation.
  4. Set both closeIcon and closeIconTint and confirm the custom drawable takes precedence.
  5. Run the unit and interop test suites and confirm all tests pass.

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 Jun 30, 2026

kiftio commented Jun 30, 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 changed the title allow customization [Android][Prototype] Allow customization Jun 30, 2026
@kiftio kiftio force-pushed the 06-30-allow_customization branch from e8f12f1 to 3d10bac Compare June 30, 2026 11:09
@kiftio kiftio force-pushed the dk/custom-bottom-sheet branch 2 times, most recently from 27ea7db to 29973d9 Compare June 30, 2026 11:32
@kiftio kiftio force-pushed the 06-30-allow_customization branch from 3d10bac to e98db56 Compare June 30, 2026 11:32
@kiftio kiftio force-pushed the dk/custom-bottom-sheet branch from 29973d9 to c66c0e4 Compare June 30, 2026 12:29
@kiftio kiftio force-pushed the 06-30-allow_customization branch 2 times, most recently from 8fe0fe2 to c8efa2e Compare June 30, 2026 12:41
@kiftio kiftio force-pushed the dk/custom-bottom-sheet branch from c66c0e4 to 33688c9 Compare June 30, 2026 12:41
@kiftio kiftio force-pushed the 06-30-allow_customization branch from c8efa2e to b381393 Compare June 30, 2026 13:32
@kiftio kiftio force-pushed the dk/custom-bottom-sheet branch from 33688c9 to 3e920bb Compare June 30, 2026 13:32
@kiftio kiftio force-pushed the 06-30-allow_customization branch from b381393 to e3ef5ef Compare June 30, 2026 13:57
@kiftio kiftio force-pushed the dk/custom-bottom-sheet branch from 3e920bb to 568a78a Compare June 30, 2026 13:57
@kiftio kiftio force-pushed the 06-30-allow_customization branch from e3ef5ef to 2e67be1 Compare July 1, 2026 10:58
@kiftio kiftio force-pushed the dk/custom-bottom-sheet branch from 568a78a to fe0e2e8 Compare July 1, 2026 10:58
@kiftio kiftio force-pushed the 06-30-allow_customization branch from 2e67be1 to 8d13f41 Compare July 1, 2026 11:22
@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 dk/custom-bottom-sheet branch 2 times, most recently from 5a4e62e to 33b1303 Compare July 3, 2026 21:05
@kiftio kiftio force-pushed the 06-30-allow_customization branch 2 times, most recently from de950ef to f000a91 Compare July 3, 2026 21:22
@kiftio kiftio force-pushed the dk/custom-bottom-sheet branch from 33b1303 to f6c2458 Compare July 6, 2026 08:34
@kiftio kiftio force-pushed the 06-30-allow_customization branch 2 times, most recently from 90d60c5 to 429d910 Compare July 6, 2026 08:55
@kiftio kiftio force-pushed the dk/custom-bottom-sheet branch from f6c2458 to aba1a8c Compare July 6, 2026 08:58
@kiftio kiftio force-pushed the 06-30-allow_customization branch from 429d910 to 9578921 Compare July 6, 2026 08:58
@kiftio kiftio changed the title [Android][Prototype] Allow customization [Android] Allow sheet customization Jul 6, 2026
@kiftio kiftio marked this pull request as ready for review July 6, 2026 09:01
@kiftio kiftio requested a review from a team as a code owner July 6, 2026 09:01
@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 190.2 KiB 199.7 KiB +9.4 KiB
Android file breakdown
File Base Head Delta
classes.jar 201.0 KiB 210.9 KiB +9.9 KiB
res/layout/checkout_sheet_content.xml 3.4 KiB 4.0 KiB +577 B
res/values/values.xml 1.1 KiB 1.2 KiB +157 B
R.txt 867 B 1.0 KiB +158 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 dk/custom-bottom-sheet branch from aba1a8c to b02925f Compare July 6, 2026 09:14
}
it.sheetStyle = CheckoutSheetStyle(
topGapDp = 24f,
cornerRadiusDp = 32f,

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.

tossed up between tokens (NONE, SMALL, MEDIUM, LARGE) and float values.

This looks more consistent with accelerated checkouts and gives best possibility of matching a consumer app

Use `closeIcon = DrawableResource(R.drawable.ic_checkout_close)` to provide a custom close drawable. If both
`closeIcon` and `closeIconTint` are set, the custom drawable takes precedence.

Set `dragHandleVisible = true` to show a fixed, visual-only drag handle at the top of the sheet. The handle is hidden

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.

https://m3.material.io/components/bottom-sheets/overview

see little drag handle at the top of the image

@kiftio kiftio force-pushed the 06-30-allow_customization branch from 4252bcb to d60c4c5 Compare July 6, 2026 09:20

@kieran-osgood-shopify kieran-osgood-shopify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a though during tophatting, as we're adding dragToDismissEnabled we might want to also add in the tapAwayToDismissEnabled just to avoid accidental checkout closures (e.g. could easily happen whilst user swipes down to see a notification)?

* cancellation remain enabled.
* @property dragHandleVisible Whether to show a visual-only drag handle at the top of the sheet. The handle is hidden
* when [dragToDismissEnabled] is false.
* @property topGapDp Space above the sheet content, excluding the status bar inset. Must be finite and non-negative.

@kieran-osgood-shopify kieran-osgood-shopify Jul 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was going to ask whether Dp is the right unit here, most sheet implementations I've seen opt for a percentage based approach however:

Looking at the material sheet design https://m3.material.io/components/bottom-sheets/specs they have some specs including it being in dp (top margin being 72dp) -

Wondering whether it's worth aligning along these lines?
Granted it's now more legacy but just to make the default design of the sheet look somewhat idiomatic, in lieu of any jetpack compose style sheets


Would it make sense from an extensibility perspective to support an array here?
snappoints is pretty common in the react-native sheet implementations, would give us the room to support multiple snap point locations without a singular "dp" from top position

findViewById<TextView>(R.id.checkoutKitHeaderTitle)
?.setTextColor(headerFontColor)
findViewById<View>(R.id.checkoutKitDragHandle)?.applyCheckoutSheetDragHandleStyle(
color = headerFontColor,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the headerFontColor the right color to apply here?

@kiftio kiftio force-pushed the dk/custom-bottom-sheet branch from b02925f to c746257 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 dk/custom-bottom-sheet branch from c746257 to 3e70d57 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.

2 participants