Skip to content

feat(RN): replace addEventListener with callback args#119

Merged
kieran-osgood-shopify merged 3 commits into
mainfrom
kieran-osgood/05-14-featremoveaddeventlistenerapi
May 22, 2026
Merged

feat(RN): replace addEventListener with callback args#119
kieran-osgood-shopify merged 3 commits into
mainfrom
kieran-osgood/05-14-featremoveaddeventlistenerapi

Conversation

@kieran-osgood-shopify
Copy link
Copy Markdown
Contributor

@kieran-osgood-shopify kieran-osgood-shopify commented May 14, 2026

What changes are you making?

The current React Native API exposes checkout.addEventListener(event, callback) for close, error, and geolocationRequest.

It operates on a "global" singleton pattern, and works well for responding to things like AppState or Keyboard, but not so much on the instances of AcceleratedCheckoutButtons or the ShopifyCheckout component.

Removing it in this PR leads us towards the future state API in upstack PR's

  <CheckoutSheet
        url={checkoutUrl}
        onCancel={() => setVisible(false)}
        onFail={() => {}}
        protocol={{
          start:    chk => analytics.track('checkout_start', { id: chk.id }),
          complete: chk => {
            reset();
            setVisible(false);
          },
          error:    err => toast(err.messages[0]?.content ?? 'Checkout error'),
        }}
      />


 ShopifyCheckoutKit.present(url, sdkHandlers, { [CheckoutProtocol.start]: c => {c.checkourUrl} })

How to test


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 platforms/swift/CHANGELOG.md
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Android version?
  • I have bumped the versionName in platforms/android/lib/build.gradle
  • I have updated platforms/android/CHANGELOG.md
  • 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.

Copy link
Copy Markdown
Contributor Author

kieran-osgood-shopify commented May 14, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 14, 2026

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 98%
96.76% (239/247) 91.02% (142/156) 100% (64/64)

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from fe4bbe0 to 866347c Compare May 14, 2026 22:05
@tiagocandido tiagocandido added the #gsd:50662 Rebase Checkout Kit on UCP label May 15, 2026 — with Graphite App
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from kieran-osgood/05-14-featremovecheckoutlifecyclefromreact-native to graphite-base/119 May 15, 2026 16:58
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from graphite-base/119 to kieran-osgood/05-14-featreact-nativeuselocalandroid/swiftprojectreferences May 15, 2026 16:58
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featreact-nativeuselocalandroid/swiftprojectreferences branch from ca7804f to 27e1a45 Compare May 15, 2026 17:57
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from 866347c to 86cefb5 Compare May 15, 2026 17:57
@kieran-osgood-shopify kieran-osgood-shopify changed the base branch from kieran-osgood/05-14-featreact-nativeuselocalandroid/swiftprojectreferences to graphite-base/119 May 15, 2026 18:12
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from 86cefb5 to fc3c557 Compare May 15, 2026 18:14
@graphite-app graphite-app Bot changed the base branch from graphite-base/119 to main May 15, 2026 18:14
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from fc3c557 to 3fe052f Compare May 15, 2026 18:14
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review May 19, 2026 14:14
@kieran-osgood-shopify kieran-osgood-shopify requested a review from a team as a code owner May 19, 2026 14:14
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as draft May 19, 2026 14:14
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch 2 times, most recently from be2d4ac to 054ed77 Compare May 19, 2026 18:53
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review May 20, 2026 08:35
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as draft May 20, 2026 08:35
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from 538a16b to 0967be1 Compare May 20, 2026 10:44
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch 4 times, most recently from bb2ece5 to f782d21 Compare May 21, 2026 09:28
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from f782d21 to 2a42f7e Compare May 21, 2026 13:38
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review May 21, 2026 14:13
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from 2a42f7e to d949cb6 Compare May 21, 2026 14:24
@kieran-osgood-shopify kieran-osgood-shopify changed the title feat: remove addEventListener API feat: replace addEventListener with callback args May 21, 2026
@kieran-osgood-shopify kieran-osgood-shopify changed the title feat: replace addEventListener with callback args feat(RN): replace addEventListener with callback args May 21, 2026
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from d949cb6 to 3921fb8 Compare May 21, 2026 14:56
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from 3921fb8 to 16be541 Compare May 22, 2026 08:26
Comment thread platforms/react-native/sample/android/app/build.gradle Outdated
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from 16be541 to 5b6cd97 Compare May 22, 2026 09:54
@kieran-osgood-shopify kieran-osgood-shopify merged commit a0c67fb into main May 22, 2026
23 checks passed
@kieran-osgood-shopify kieran-osgood-shopify deleted the kieran-osgood/05-14-featremoveaddeventlistenerapi branch May 22, 2026 10:17
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.

3 participants