Skip to content

Commit 1570a74

Browse files
committed
Normalize RN checkout E2E native support
1 parent 8226cc7 commit 1570a74

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

platforms/react-native/modules/@shopify/checkout-kit-react-native/ios/AcceleratedCheckoutButtons.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,18 @@ class RCTAcceleratedCheckoutButtonsView: UIView {
288288

289289
// Attach config (and Apple Pay config if available)
290290
if let applePayConfig = AcceleratedCheckoutConfiguration.shared.applePayConfiguration {
291-
view = AnyView(buttons.environmentObject(config).environmentObject(applePayConfig).environment(\.colorScheme, colorScheme))
291+
view = AnyView(
292+
buttons
293+
.environment(\.shopifyAcceleratedCheckoutsConfiguration, config)
294+
.environment(\.shopifyApplePayConfiguration, applePayConfig)
295+
.environment(\.colorScheme, colorScheme)
296+
)
292297
} else {
293-
view = AnyView(buttons.environmentObject(config).environment(\.colorScheme, colorScheme))
298+
view = AnyView(
299+
buttons
300+
.environment(\.shopifyAcceleratedCheckoutsConfiguration, config)
301+
.environment(\.colorScheme, colorScheme)
302+
)
294303
}
295304

296305
if let hostingController {

platforms/swift/Sources/ShopifyCheckoutKit/CheckoutWebViewController.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import WebKit
33

44
@MainActor
55
class CheckoutWebViewController: UIViewController, UIAdaptivePresentationControllerDelegate {
6+
private static let closeButtonAccessibilityLabel = "Close Checkout"
7+
68
var onCancel: (() -> Void)?
79
var onFail: ((CheckoutError) -> Void)?
810
weak var delegate: (any CheckoutDelegate)?
@@ -41,14 +43,17 @@ class CheckoutWebViewController: UIViewController, UIAdaptivePresentationControl
4143
}
4244

4345
item.tintColor = closeButtonTintColor
46+
item.accessibilityLabel = Self.closeButtonAccessibilityLabel
4447
return item
4548
}
4649

47-
return UIBarButtonItem(
50+
let item = UIBarButtonItem(
4851
barButtonSystemItem: .close,
4952
target: self,
5053
action: #selector(close)
5154
)
55+
item.accessibilityLabel = Self.closeButtonAccessibilityLabel
56+
return item
5257
}()
5358

5459
var progressObserver: NSKeyValueObservation?

platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutViewControllerTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class CheckoutViewDelegateTests: XCTestCase {
8686
XCTAssertNotNil(closeButton)
8787
XCTAssertEqual(closeButton?.style, .plain)
8888
XCTAssertNil(closeButton?.image)
89+
XCTAssertEqual(closeButton?.accessibilityLabel, "Close Checkout")
8990
}
9091

9192
func testCloseButtonUsesCustomImageAndTintWhenColorIsSet() {
@@ -98,6 +99,7 @@ class CheckoutViewDelegateTests: XCTestCase {
9899
XCTAssertEqual(closeButton?.style, .plain)
99100
XCTAssertNotNil(closeButton?.image)
100101
XCTAssertEqual(closeButton?.tintColor, customColor)
102+
XCTAssertEqual(closeButton?.accessibilityLabel, "Close Checkout")
101103
}
102104

103105
func testCloseButtonImageIsXMarkCircleFill() {

0 commit comments

Comments
 (0)