Skip to content

Commit f498da0

Browse files
authored
Fix issue with frozen checkout state on dismiss (#72)
* Fix issue with frozen checkout state on dismiss * Dismiss rootViewController
1 parent 458c326 commit f498da0

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 1.0.3 - February 21, 2024
4+
5+
- Fixes an issue where the checkout can remain in a frozen empty state after
6+
being dismissed.
7+
38
## 1.0.2 - February 21, 2024
49

510
- Improve "close" event logic by only dismissing the Checkout sheet.

modules/@shopify/checkout-sheet-kit/ios/ShopifyCheckoutSheetKit.swift

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,8 @@ import React
2828

2929
@objc(RCTShopifyCheckoutSheetKit)
3030
class RCTShopifyCheckoutSheetKit: RCTEventEmitter, CheckoutDelegate {
31-
private var viewControlller: UIViewController?
32-
3331
private var hasListeners = false
3432

35-
override init() {
36-
super.init()
37-
}
38-
3933
override var methodQueue: DispatchQueue! {
4034
return DispatchQueue.main
4135
}
@@ -89,8 +83,10 @@ class RCTShopifyCheckoutSheetKit: RCTEventEmitter, CheckoutDelegate {
8983
if self.hasListeners {
9084
self.sendEvent(withName: "close", body: nil)
9185
}
92-
self.viewControlller?.dismiss(animated: true)
93-
self.viewControlller = nil
86+
87+
if let viewController = UIApplication.shared.delegate?.window??.rootViewController {
88+
viewController.dismiss(animated: true)
89+
}
9490
}
9591
}
9692

@@ -128,7 +124,6 @@ class RCTShopifyCheckoutSheetKit: RCTEventEmitter, CheckoutDelegate {
128124
DispatchQueue.main.async {
129125
if let url = URL(string: checkoutURL), let viewController = self.getCurrentViewController() {
130126
ShopifyCheckoutSheetKit.present(checkout: url, from: viewController, delegate: self)
131-
self.viewControlller = viewController
132127
}
133128
}
134129
}

modules/@shopify/checkout-sheet-kit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@shopify/checkout-sheet-kit",
33
"license": "MIT",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"main": "lib/commonjs/index.js",
66
"types": "src/index.ts",
77
"source": "src/index.ts",

0 commit comments

Comments
 (0)