From 4def40a8b57ba5f69342226ad23f766d0ee2ba55 Mon Sep 17 00:00:00 2001 From: chtnsngh <70207147+chtnsngh@users.noreply.github.com> Date: Wed, 22 Sep 2021 12:49:03 +0530 Subject: [PATCH] Update RazorpayCheckout.m The razorpay checkout webview was not presented properly. finding the correct rootviewController to present it. --- ios/RazorpayCheckout.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ios/RazorpayCheckout.m b/ios/RazorpayCheckout.m index 57c8eb1f..b0f3e109 100644 --- a/ios/RazorpayCheckout.m +++ b/ios/RazorpayCheckout.m @@ -36,12 +36,17 @@ @implementation RNRazorpayCheckout //get root view to present razorpay vc id app = [[UIApplication sharedApplication] delegate]; - UINavigationController *rootViewController = ((UINavigationController*) app.window.rootViewController); + UIViewController *rootViewController = ((UIViewController*) app.window.rootViewController); - if (rootViewController.presentedViewController) { - [razorpay open:tempOptions displayController:rootViewController.presentedViewController]; - return; + while (rootViewController.presentedViewController) { + rootViewController = rootViewController.presentedViewController; } + + +// if (rootViewController.presentedViewController) { +// [razorpay open:tempOptions displayController:rootViewController.presentedViewController]; +// return; +// } //Use 'open' method with displayController parameter [razorpay open:tempOptions displayController:rootViewController];