Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## x.x.x - 2025-x-x

**Fixes**
- [#2201](https://github.com/stripe/stripe-react-native/issues/2201) Fixed iOS sheets (PaymentSheet, CustomerSheet, AddressSheet, etc.) not presenting in scene-based lifecycle apps. The SDK now properly supports both traditional app delegates and scene-based lifecycles (iOS 13+) by using `RCTKeyWindow`.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe confusing to specify iOS 13+ since this is all we support?


## 0.56.0 - 2025-11-06

**Changes**
Expand Down
2 changes: 1 addition & 1 deletion ios/AddressSheet/AddressSheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class AddressSheetView: UIView {
let navigationController = UINavigationController(rootViewController: addressViewController!)
navigationController.modalPresentationStyle = getModalPresentationStyle()
navigationController.modalTransitionStyle = getModalTransitionStyle()
let vc = findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
let vc = findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController())
vc.present(navigationController, animated: true)
}

Expand Down
4 changes: 2 additions & 2 deletions ios/FinancialConnections.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FinancialConnections {
)
financialConnectionsSheet.onEvent = onEvent
financialConnectionsSheet.present(
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
from: findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController()),
completion: { result in
switch result {
case .completed(session: let session):
Expand Down Expand Up @@ -55,7 +55,7 @@ class FinancialConnections {
)
financialConnectionsSheet.onEvent = onEvent
financialConnectionsSheet.presentForToken(
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
from: findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController()),
completion: { result in
switch result {
case .completed(result: let result):
Expand Down
2 changes: 1 addition & 1 deletion ios/PushProvisioning/AddToWalletButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class AddToWalletButtonView: UIView {
return self.testEnv ? STPFakeAddPaymentPassViewController(requestConfiguration: config, delegate: self) : PKAddPaymentPassViewController(requestConfiguration: config, delegate: self)
}()

let vc = findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
let vc = findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController())
vc.present(controller!, animated: true, completion: nil)
}

Expand Down
2 changes: 1 addition & 1 deletion ios/StripeSdkImpl+CustomerSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ extension StripeSdkImpl {
}

DispatchQueue.main.async {
self.customerSheetViewController = findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
self.customerSheetViewController = findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController())
if let customerSheetViewController = self.customerSheetViewController {
customerSheetViewController.modalPresentationStyle = CustomerSheetUtils.getModalPresentationStyle(params["presentationStyle"] as? String)
customerSheetViewController.modalTransitionStyle = CustomerSheetUtils.getModalTransitionStyle(params["animationStyle"] as? String)
Expand Down
12 changes: 6 additions & 6 deletions ios/StripeSdkImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public class StripeSdkImpl: NSObject, UIAdaptivePresentationControllerDelegate {
rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
DispatchQueue.main.async {
if (self.paymentSheetFlowController != nil) {
self.paymentSheetFlowController?.confirm(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()) { paymentResult in
self.paymentSheetFlowController?.confirm(from: RCTKeyWindow()?.rootViewController ?? UIViewController()) { paymentResult in
switch paymentResult {
case .completed:
resolve([])
Expand Down Expand Up @@ -228,7 +228,7 @@ public class StripeSdkImpl: NSObject, UIAdaptivePresentationControllerDelegate {
}
}
DispatchQueue.main.async {
paymentSheetViewController = UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()
paymentSheetViewController = RCTKeyWindow()?.rootViewController ?? UIViewController()
if let paymentSheetFlowController = self.paymentSheetFlowController {
paymentSheetFlowController.presentPaymentOptions(from: findViewControllerPresenter(from: paymentSheetViewController!)
) { didCancel in
Expand Down Expand Up @@ -451,7 +451,7 @@ public class StripeSdkImpl: NSObject, UIAdaptivePresentationControllerDelegate {
if let applePaymentAuthorizationController = self.applePaymentAuthorizationController {
applePaymentAuthorizationController.delegate = self
DispatchQueue.main.async {
let vc = findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
let vc = findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController())
vc.present(
applePaymentAuthorizationController,
animated: true,
Expand Down Expand Up @@ -784,7 +784,7 @@ public class StripeSdkImpl: NSObject, UIAdaptivePresentationControllerDelegate {
clientSecret: clientSecret as String,
returnURL: connectionsReturnURL,
params: collectParams,
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
from: findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController()),
onEvent: onEvent
) { intent, error in
if let error = error {
Expand All @@ -811,7 +811,7 @@ public class StripeSdkImpl: NSObject, UIAdaptivePresentationControllerDelegate {
clientSecret: clientSecret as String,
returnURL: connectionsReturnURL,
params: collectParams,
from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()),
from: findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController()),
onEvent: onEvent
) { intent, error in
if let error = error {
Expand Down Expand Up @@ -1242,7 +1242,7 @@ func findViewControllerPresenter(from uiViewController: UIViewController) -> UIV

extension StripeSdkImpl: STPAuthenticationContext {
public func authenticationPresentingViewController() -> UIViewController {
return findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController())
return findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController())
}
}

Expand Down