瀏覽代碼

Improve getCurrentlyVisibleScreenId on iOS with drawers. (#2052)

Royce Townsend 6 年之前
父節點
當前提交
2c30a52bb9
共有 2 個文件被更改,包括 9 次插入1 次删除
  1. 8
    0
      ios/RCCManagerModule.m
  2. 1
    1
      ios/RCCNavigationController.m

+ 8
- 0
ios/RCCManagerModule.m 查看文件

@@ -377,6 +377,14 @@ RCT_EXPORT_METHOD(
377 377
     {
378 378
         return [self getVisibleViewControllerFor:vc.presentedViewController];
379 379
     }
380
+    else if ([vc isKindOfClass:[TheSidebarController class]]) {
381
+        TheSidebarController *drawerController = (TheSidebarController*) vc;
382
+        return [self getVisibleViewControllerFor:drawerController.contentViewController];
383
+    }
384
+    else if ([vc isKindOfClass:[MMDrawerController class]]) {
385
+        MMDrawerController *drawerController = (MMDrawerController*) vc;
386
+        return [self getVisibleViewControllerFor:drawerController.centerViewController];
387
+    }
380 388
     else
381 389
     {
382 390
         return vc;

+ 1
- 1
ios/RCCNavigationController.m 查看文件

@@ -41,7 +41,7 @@ NSString const *CALLBACK_ASSOCIATED_ID = @"RCCNavigationController.CALLBACK_ASSO
41 41
   
42 42
   RCCViewController *viewController = [[RCCViewController alloc] initWithComponent:component passProps:passProps navigatorStyle:navigatorStyle globalProps:globalProps bridge:bridge];
43 43
   if (!viewController) return nil;
44
-  viewController.controllerId = props[@"id"];
44
+  viewController.controllerId = passProps[@"screenInstanceID"];
45 45
   
46 46
   NSArray *leftButtons = props[@"leftButtons"];
47 47
   if (leftButtons)