Browse Source

Fix topBar background color animation on iOS 13

yogevbd 5 years ago
parent
commit
0c6e2f00b1
2 changed files with 8 additions and 4 deletions
  1. 0
    2
      lib/ios/UINavigationBar+utils.h
  2. 8
    2
      lib/ios/UINavigationBar+utils.m

+ 0
- 2
lib/ios/UINavigationBar+utils.h View File

@@ -4,8 +4,6 @@
4 4
 
5 5
 - (void)rnn_setBackgroundColor:(UIColor *)color;
6 6
 
7
-- (void)rnn_setBackgroundColorTransparent;
8
-
9 7
 - (void)rnn_setBackIndicatorImage:(UIImage *)image;
10 8
 
11 9
 - (void)rnn_showBorder:(BOOL)showBorder;

+ 8
- 2
lib/ios/UINavigationBar+utils.m View File

@@ -29,7 +29,6 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
29 29
 
30 30
 - (void)setBackgroundColor:(UIColor *)color {
31 31
     if (@available(iOS 13.0, *)) {
32
-        [self configureWithDefaultBackground];
33 32
         [self getNavigaitonBarStandardAppearance].backgroundColor = color;
34 33
         [self getNavigaitonBarCompactAppearance].backgroundColor = color;
35 34
         [self getNavigaitonBarScrollEdgeAppearance].backgroundColor = color;
@@ -41,7 +40,14 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
41 40
 
42 41
 - (void)setBackgroundColorTransparent {
43 42
     if (@available(iOS 13.0, *)) {
44
-        [self configureWithTransparentBackground];
43
+        UIColor* clearColor = [UIColor clearColor];
44
+        [self getNavigaitonBarStandardAppearance].backgroundColor = clearColor;
45
+        [self getNavigaitonBarCompactAppearance].backgroundColor = clearColor;
46
+        [self getNavigaitonBarScrollEdgeAppearance].backgroundColor = clearColor;
47
+        [self getNavigaitonBarStandardAppearance].backgroundEffect = nil;
48
+        [self getNavigaitonBarCompactAppearance].backgroundEffect = nil;
49
+        [self getNavigaitonBarScrollEdgeAppearance].backgroundEffect = nil;
50
+        
45 51
     } else {
46 52
         if (![self viewWithTag:TOP_BAR_TRANSPARENT_TAG]){
47 53
             UIView *transparentView = [[UIView alloc] initWithFrame:CGRectZero];