Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Navigation Bar colors get applied in the DropIn #435

Closed
FranciPC7 opened this issue Dec 11, 2023 · 2 comments · Fixed by #436
Closed

Global Navigation Bar colors get applied in the DropIn #435

FranciPC7 opened this issue Dec 11, 2023 · 2 comments · Fixed by #436
Labels

Comments

@FranciPC7
Copy link

Braintree Drop-in SDK Version

9.10.0

Environment

Sandbox

Xcode Version

Xcode 15

OS Version & Device

iPhone 12 - iOS 17

Integration type

CocoaPods

Development Processor

Apple Silicon (M-series chips)

Describe the bug

In SwiftUI it is common practice to define global navigation bar colors via AppDelegate:

let navBarAppearance = UINavigationBarAppearance()
        let backItemAppearance = UIBarButtonItemAppearance()
        backItemAppearance.normal.titleTextAttributes = [.foregroundColor : UIColor.colorToolsText] // fix text color
        navBarAppearance.backButtonAppearance = backItemAppearance
        let image = UIImage(systemName: "chevron.backward")?.withTintColor(.colorToolsText, renderingMode: .alwaysOriginal) // fix indicator color
        navBarAppearance.setBackIndicatorImage(image, transitionMaskImage: image)
        
        navBarAppearance.configureWithOpaqueBackground()
        navBarAppearance.titleTextAttributes = [.foregroundColor: UIColor.colorToolsText]
        navBarAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.colorToolsText]
        navBarAppearance.backgroundColor = .colorPrimaryDark
        UINavigationBar.appearance().standardAppearance = navBarAppearance
        UINavigationBar.appearance().scrollEdgeAppearance = navBarAppearance
        
        UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).backgroundColor = .white.withAlphaComponent(0.15)

In the DropIn version 9.* the DropIn takes over the default color which results in unconsistent color scheming and we can't get back to usage of default navigation bar colors.

IMG_1942

To reproduce

  1. Have Global navigation bar colors defined
    AppDelegate.swift
let navBarAppearance = UINavigationBarAppearance()
        let backItemAppearance = UIBarButtonItemAppearance()
        backItemAppearance.normal.titleTextAttributes = [.foregroundColor : UIColor.colorToolsText] // fix text color
        navBarAppearance.backButtonAppearance = backItemAppearance
        let image = UIImage(systemName: "chevron.backward")?.withTintColor(.colorToolsText, renderingMode: .alwaysOriginal) // fix indicator color
        navBarAppearance.setBackIndicatorImage(image, transitionMaskImage: image)
        
        navBarAppearance.configureWithOpaqueBackground()
        navBarAppearance.titleTextAttributes = [.foregroundColor: UIColor.colorToolsText]
        navBarAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.colorToolsText]
        navBarAppearance.backgroundColor = .colorPrimaryDark
        UINavigationBar.appearance().standardAppearance = navBarAppearance
        UINavigationBar.appearance().scrollEdgeAppearance = navBarAppearance
        
        UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).backgroundColor = .white.withAlphaComponent(0.15)
  1. Initiate Drop In controller and the colors will follow te global design, no way to use the default colors. Also the cancel button color can't be set.

Expected behavior

I would expect to have option to keep the original design of the DropIn regardless the global config or atleast have the option to set more color options of the navigation bar of the controller.

Screenshots

IMG_1942

@jaxdesmarais
Copy link
Contributor

Hello @FranciPC7 -

Thanks for bringing this to our attention, I can reproduce the same behavior in a UIKit view as well. This appears to be an oversight on our end as other navigation bar items within the SDK are customizable via BTDropInUICustomization. We will work on getting this bug addressed so you can pass in customizations or a default via BTDropInUICustomization.

@jaxdesmarais
Copy link
Contributor

Hey @FranciPC7 -

The fix for this has been released in Drop-in v9.10.1. Additionally, if desired you can use BTDropInRequest.uiCustomization to customize the color scheme, otherwise the default will be used. Thanks again for bringing this bug to our attention and using the SDK!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants