From 424731fa7d66944868e28763b6d53f24eaffdf46 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Mon, 6 Dec 2021 19:14:54 +0100 Subject: [PATCH] fix: show picker modal from within another modal (#429) --- ios/RNDatePicker/RNDatePickerManager.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ios/RNDatePicker/RNDatePickerManager.m b/ios/RNDatePicker/RNDatePickerManager.m index 34a64eb..d331829 100644 --- a/ios/RNDatePicker/RNDatePickerManager.m +++ b/ios/RNDatePicker/RNDatePickerManager.m @@ -139,7 +139,13 @@ RCT_EXPORT_METHOD(openPicker:(NSDictionary *) props [popPresenter setPermittedArrowDirections: (UIPopoverArrowDirection) 0]; } - [rootViewController presentViewController:alertController animated:YES completion:nil]; + // Finding the top view controller which is neccessary to be able to show the picker from within modal + UIViewController *topViewController = rootViewController; + while (topViewController.presentedViewController){ + topViewController = topViewController.presentedViewController; + } + + [topViewController presentViewController:alertController animated:YES completion:nil]; }); }