From c03bfbc8974dc54c7f99f21d539f40dc6b8fba7e Mon Sep 17 00:00:00 2001 From: Royce Townsend Date: Sat, 21 Oct 2017 00:11:28 +0800 Subject: [PATCH] Improve getCurrentlyVisibleScreenId on iOS with drawers. --- ios/RCCManagerModule.m | 8 ++++++++ ios/RCCNavigationController.m | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ios/RCCManagerModule.m b/ios/RCCManagerModule.m index 86aa9eeb9cb..0c3f969bff1 100755 --- a/ios/RCCManagerModule.m +++ b/ios/RCCManagerModule.m @@ -371,6 +371,14 @@ - (UIViewController *) getVisibleViewControllerFor:(UIViewController *)vc { return [self getVisibleViewControllerFor:vc.presentedViewController]; } + else if ([vc isKindOfClass:[TheSidebarController class]]) { + TheSidebarController *drawerController = (TheSidebarController*) vc; + return [self getVisibleViewControllerFor:drawerController.contentViewController]; + } + else if ([vc isKindOfClass:[MMDrawerController class]]) { + MMDrawerController *drawerController = (MMDrawerController*) vc; + return [self getVisibleViewControllerFor:drawerController.centerViewController]; + } else { return vc; diff --git a/ios/RCCNavigationController.m b/ios/RCCNavigationController.m index dda66881a93..20494397771 100755 --- a/ios/RCCNavigationController.m +++ b/ios/RCCNavigationController.m @@ -36,7 +36,7 @@ - (instancetype)initWithProps:(NSDictionary *)props children:(NSArray *)children RCCViewController *viewController = [[RCCViewController alloc] initWithComponent:component passProps:passProps navigatorStyle:navigatorStyle globalProps:globalProps bridge:bridge]; if (!viewController) return nil; - viewController.controllerId = props[@"id"]; + viewController.controllerId = passProps[@"screenInstanceID"]; NSArray *leftButtons = props[@"leftButtons"]; if (leftButtons)