Skip to content

Commit

Permalink
Fix topBar transparent background on iOS 12 (#5791)
Browse files Browse the repository at this point in the history
* Fix topBar transparent background on iOS 12

* Fix unit test iOS destination
  • Loading branch information
yogevbd authored Dec 18, 2019
1 parent 71af559 commit cd3d347
Show file tree
Hide file tree
Showing 10 changed files with 946 additions and 30 deletions.
4 changes: 0 additions & 4 deletions lib/ios/TopBarAppearancePresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ - (void)updateBackgroundAppearance {
}
}

- (BOOL)transparent {
return (_backgroundColor && CGColorGetAlpha(_backgroundColor.CGColor) == 0.0);
}

- (void)showBorder:(BOOL)showBorder {
UIColor* shadowColor = showBorder ? [[UINavigationBarAppearance new] shadowColor] : nil;
_appearance.shadowColor = shadowColor;
Expand Down
3 changes: 2 additions & 1 deletion lib/ios/TopBarPresenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

- (instancetype)initWithNavigationController:(UINavigationController *)boundNavigationController;

@property (nonatomic) BOOL transparent;
- (BOOL)transparent;

@property (nonatomic) BOOL translucent;
@property (nonatomic, strong) UIColor* backgroundColor;

Expand Down
6 changes: 5 additions & 1 deletion lib/ios/TopBarPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ - (void)setBackgroundColor:(UIColor *)backgroundColor {
}

- (void)updateBackgroundAppearance {
if (_transparent) {
if (self.transparent) {
[self setBackgroundColorTransparent];
} else if (_backgroundColor) {
self.navigationController.navigationBar.barTintColor = _backgroundColor;
Expand Down Expand Up @@ -125,4 +125,8 @@ - (void)setBackButtonIcon:(UIImage *)icon withColor:(UIColor *)color title:(NSSt
lastViewControllerInStack.navigationItem.backBarButtonItem = backItem;
}

- (BOOL)transparent {
return (_backgroundColor && CGColorGetAlpha(_backgroundColor.CGColor) == 0.0);
}

@end
22 changes: 22 additions & 0 deletions playground/ios/NavigationIOS12Tests/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Loading

0 comments on commit cd3d347

Please sign in to comment.