Browse Source

Fixed tab bar layout animation. When first time each tab selected and the layout animation weirdly and defaultly happend. (#597)

Ran 8 years ago
parent
commit
daec36e08f
1 changed files with 20 additions and 0 deletions
  1. 20
    0
      ios/RCCTabBarController.m

+ 20
- 0
ios/RCCTabBarController.m View File

@@ -2,9 +2,27 @@
2 2
 #import "RCCViewController.h"
3 3
 #import "RCTConvert.h"
4 4
 #import "RCCManager.h"
5
+#import "RCTUIManager.h"
6
+
7
+@interface RCTUIManager ()
8
+
9
+- (void)configureNextLayoutAnimation:(NSDictionary *)config
10
+                        withCallback:(RCTResponseSenderBlock)callback
11
+                       errorCallback:(__unused RCTResponseSenderBlock)errorCallback;
12
+
13
+@end
5 14
 
6 15
 @implementation RCCTabBarController
7 16
 
17
+- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
18
+  id queue = [[RCCManager sharedInstance].getBridge uiManager].methodQueue;
19
+  dispatch_async(queue, ^{
20
+    [[[RCCManager sharedInstance].getBridge uiManager] configureNextLayoutAnimation:nil withCallback:^(NSArray* arr){} errorCallback:^(NSArray* arr){}];
21
+  });
22
+  
23
+  return YES;
24
+}
25
+
8 26
 - (UIImage *)image:(UIImage*)image withColor:(UIColor *)color1
9 27
 {
10 28
   UIGraphicsBeginImageContextWithOptions(image.size, NO, image.scale);
@@ -26,6 +44,8 @@
26 44
   self = [super init];
27 45
   if (!self) return nil;
28 46
   
47
+  self.delegate = self;
48
+  
29 49
   self.tabBar.translucent = YES; // default
30 50
   
31 51
   UIColor *buttonColor = nil;