Skip to content

Commit

Permalink
Fix Navigation Bar Bug (#436)
Browse files Browse the repository at this point in the history
* Fix bug where setting global navigation bar overrides the payment selection screen
* Allow overriding navigation bar color and text via BTDropInUICustomization.barBackgroundColor and BTDropInUICustomization.primaryTextColor
* This allows the payment selection screen to be customized in the same way as the other views
  • Loading branch information
jaxdesmarais authored Dec 18, 2023
1 parent 679100e commit 503e48a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Braintree iOS Drop-in SDK - Release Notes

## unreleased
* Fix bug where setting global navigation bar overrides the payment selection screen (fixes #435)
* Allow overriding navigation bar color and text via `BTDropInUICustomization.barBackgroundColor` and `BTDropInUICustomization.primaryTextColor`

## 9.10.0 (2023-09-06)
* Require `braintree_ios` 5.23.0
* Update to use macros to avoid compile time errors (fixes #421)
Expand Down
11 changes: 11 additions & 0 deletions Sources/BraintreeDropIn/BTPaymentSelectionViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ - (void)viewDidLoad {
[titleLabel sizeToFit];
self.navigationItem.titleView = titleLabel;

self.navigationController.navigationBar.barTintColor = [BTUIKAppearance sharedInstance].barBackgroundColor;
self.navigationController.navigationBar.translucent = NO;
if (@available(iOS 15, *)) {
UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc]init];
appearance.backgroundColor = [BTUIKAppearance sharedInstance].barBackgroundColor;

self.navigationController.navigationBar.standardAppearance = appearance;
self.navigationController.navigationBar.scrollEdgeAppearance = self.navigationController.navigationBar.standardAppearance;
}

[self.navigationController.navigationBar setTitleTextAttributes:@{ NSForegroundColorAttributeName: [BTUIKAppearance sharedInstance].primaryTextColor }];
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; // make nav bar clear
self.view.backgroundColor = UIColor.clearColor;

Expand Down

0 comments on commit 503e48a

Please sign in to comment.