diff --git a/node_modules/react-native-navigation/lib/ios/RNNCommandsHandler.m b/node_modules/react-native-navigation/lib/ios/RNNCommandsHandler.m index 91b878d..9cd61d5 100644 --- a/node_modules/react-native-navigation/lib/ios/RNNCommandsHandler.m +++ b/node_modules/react-native-navigation/lib/ios/RNNCommandsHandler.m @@ -72,7 +72,7 @@ - (void)setRoot:(NSDictionary*)layout commandId:(NSString*)commandId completion: } } - [_modalManager dismissAllModalsAnimated:NO]; + [_modalManager dismissAllModalsAnimated:NO completion:nil]; UIViewController *vc = [_controllerFactory createLayout:layout[@"root"]]; @@ -286,10 +286,9 @@ - (void)dismissAllModals:(NSDictionary *)mergeOptions commandId:(NSString*)comma [CATransaction begin]; [CATransaction setCompletionBlock:^{ [_eventEmitter sendOnNavigationCommandCompletion:dismissAllModals commandId:commandId params:@{}]; - completion(); }]; RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:mergeOptions]; - [_modalManager dismissAllModalsAnimated:[options.animations.dismissModal.enable getWithDefaultValue:YES]]; + [_modalManager dismissAllModalsAnimated:[options.animations.dismissModal.enable getWithDefaultValue:YES] completion:completion]; [CATransaction commit]; } diff --git a/node_modules/react-native-navigation/lib/ios/RNNModalManager.h b/node_modules/react-native-navigation/lib/ios/RNNModalManager.h index 9809db0..a602c92 100644 --- a/node_modules/react-native-navigation/lib/ios/RNNModalManager.h +++ b/node_modules/react-native-navigation/lib/ios/RNNModalManager.h @@ -19,6 +19,6 @@ typedef void (^RNNTransitionRejectionBlock)(NSString *code, NSString *message, N - (void)showModal:(UIViewController *)viewController animated:(BOOL)animated completion:(RNNTransitionWithComponentIdCompletionBlock)completion; - (void)showModal:(UIViewController *)viewController animated:(BOOL)animated hasCustomAnimation:(BOOL)hasCustomAnimation completion:(RNNTransitionWithComponentIdCompletionBlock)completion; - (void)dismissModal:(UIViewController *)viewController completion:(RNNTransitionCompletionBlock)completion; -- (void)dismissAllModalsAnimated:(BOOL)animated; +- (void)dismissAllModalsAnimated:(BOOL)animated completion:(RNNTransitionCompletionBlock)completion; @end diff --git a/node_modules/react-native-navigation/lib/ios/RNNModalManager.m b/node_modules/react-native-navigation/lib/ios/RNNModalManager.m index 18c0eb8..a404da7 100644 --- a/node_modules/react-native-navigation/lib/ios/RNNModalManager.m +++ b/node_modules/react-native-navigation/lib/ios/RNNModalManager.m @@ -50,9 +50,16 @@ - (void)dismissModal:(UIViewController *)viewController completion:(RNNTransitio } } --(void)dismissAllModalsAnimated:(BOOL)animated { +-(void)dismissAllModalsAnimated:(BOOL)animated completion:(RNNTransitionCompletionBlock)completion { + if (!_presentedModals || !_presentedModals.count) { + if (completion) { + completion(); + } + return; + } + UIViewController *root = UIApplication.sharedApplication.delegate.window.rootViewController; - [root dismissViewControllerAnimated:animated completion:nil]; + [root dismissViewControllerAnimated:animated completion:completion]; [_delegate dismissedMultipleModals:_presentedModals]; [_pendingModalIdsToDismiss removeAllObjects]; [_presentedModals removeAllObjects]; diff --git a/node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj/xcuserdata/miguel.xcuserdatad/xcschemes/xcschememanagement.plist b/node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj/xcuserdata/miguel.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..a2f2607 --- /dev/null +++ b/node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj/xcuserdata/miguel.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + ReactNativeNavigation.xcscheme_^#shared#^_ + + orderHint + 6 + + + + diff --git a/node_modules/react-native-navigation/lib/ios/ReactNativeNavigationTests/RNNModalManagerTest.m b/node_modules/react-native-navigation/lib/ios/ReactNativeNavigationTests/RNNModalManagerTest.m index 407051a..8f02aae 100644 --- a/node_modules/react-native-navigation/lib/ios/ReactNativeNavigationTests/RNNModalManagerTest.m +++ b/node_modules/react-native-navigation/lib/ios/ReactNativeNavigationTests/RNNModalManagerTest.m @@ -51,7 +51,7 @@ - (void)testDismissMultipleModalsInvokeDelegateWithCorrectParameters { [_modalManager showModal:_vc3 animated:NO completion:nil]; _modalManager.delegate = self; - [_modalManager dismissAllModalsAnimated:NO]; + [_modalManager dismissAllModalsAnimated:NO completion:nil]; XCTAssertTrue(_modalDismissedCount == 3); } @@ -87,7 +87,7 @@ - (void)testDismissAllModals_AfterDismissingPreviousModal_InvokeDelegateWithCorr [_modalManager dismissModal:_vc2 completion:nil]; XCTAssertTrue(_modalDismissedCount == 1); - [_modalManager dismissAllModalsAnimated:NO]; + [_modalManager dismissAllModalsAnimated:NO completion:nil]; XCTAssertTrue(_modalDismissedCount == 2); }