Browse Source

fixed toggle tabs bug (#2369)

yogevbd 6 years ago
parent
commit
d0d291dade
No account linked to committer's email address
3 changed files with 4 additions and 1 deletions
  1. 2
    0
      ios/RCCTabBarController.h
  2. 1
    0
      ios/RCCTabBarController.m
  3. 1
    1
      ios/RCCViewController.m

+ 2
- 0
ios/RCCTabBarController.h View File

6
 - (instancetype)initWithProps:(NSDictionary *)props children:(NSArray *)children globalProps:(NSDictionary*)globalProps bridge:(RCTBridge *)bridge;
6
 - (instancetype)initWithProps:(NSDictionary *)props children:(NSArray *)children globalProps:(NSDictionary*)globalProps bridge:(RCTBridge *)bridge;
7
 - (void)performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams bridge:(RCTBridge *)bridge completion:(void (^)(void))completion;
7
 - (void)performAction:(NSString*)performAction actionParams:(NSDictionary*)actionParams bridge:(RCTBridge *)bridge completion:(void (^)(void))completion;
8
 
8
 
9
+@property (nonatomic) BOOL tabBarHidden;
10
+
9
 @end
11
 @end

+ 1
- 0
ios/RCCTabBarController.m View File

350
   if ([performAction isEqualToString:@"setTabBarHidden"])
350
   if ([performAction isEqualToString:@"setTabBarHidden"])
351
   {
351
   {
352
     BOOL hidden = [actionParams[@"hidden"] boolValue];
352
     BOOL hidden = [actionParams[@"hidden"] boolValue];
353
+    self.tabBarHidden = hidden;
353
     
354
     
354
     CGRect nextFrame = self.tabBar.frame;
355
     CGRect nextFrame = self.tabBar.frame;
355
     nextFrame.origin.y = UIScreen.mainScreen.bounds.size.height - (hidden ? 0 : self.tabBar.frame.size.height);
356
     nextFrame.origin.y = UIScreen.mainScreen.bounds.size.height - (hidden ? 0 : self.tabBar.frame.size.height);

+ 1
- 1
ios/RCCViewController.m View File

719
 - (BOOL)hidesBottomBarWhenPushed
719
 - (BOOL)hidesBottomBarWhenPushed
720
 {
720
 {
721
   if (!self._hidesBottomBarWhenPushed) return NO;
721
   if (!self._hidesBottomBarWhenPushed) return NO;
722
-  return (self.navigationController.topViewController == self);
722
+  return (self.navigationController.topViewController == self) && ![(RCCTabBarController*)self.tabBarController tabBarHidden];
723
 }
723
 }
724
 
724
 
725
 - (BOOL)prefersStatusBarHidden
725
 - (BOOL)prefersStatusBarHidden