1

The view hierarchy is as follow:

UITabBarController -> UIHostingController -> NavigationStack -> View -> ScrollView

When the keyboard is displayed and dismissed it does not use the same timing curve as the scroll view re-adjusting itself and there is a white background that is exposed. Apparently, it is a SwiftUI._UIHostingView<SwiftUI.AnyView> but I do not have access to it to change it's background color.

var body: some View {
    NavigationStack(path: $path) {
        AccountView()
        .background(Color(uiColor: UIColor.green))
        .navigationDestination(for: AccountDestination.self) { destination in
            ...
        }
    }
    .tint(Color(UIColor.lightOrange))
    .background(Color(uiColor: UIColor.blue))
}

enter image description here enter image description here

How do I change the background color of the white view?

price
  • 43
  • 1
  • 6
  • There's a tab bar view somewhere. From the screenshot, it looks like it has a white background. It also looks like the popup is presented from somewhere else than the visible view. I assume this is why the keyboard has a different background. – lazarevzubov Mar 30 '23 at 05:44
  • By popup, do you mean Alert? It is being presented from a SwiftUI View using the .alert modifier. The UITabController is behind the NavigationStack. Changing the color of the TabBar view changes the color of a view behind the blue view. `self.view.backgroundColor = UIColor.yellowColor` The view with the white background seems to be in front of the NavigationStack, but behind the AccountView. – price Mar 30 '23 at 17:17

0 Answers0