flowkey / UIKit-cross-platform

Cross-platform Swift implementation of UIKit, mostly for Android
MIT License
594 stars 40 forks source link

UINavigationController does not call `viewWillAppear` #341

Closed OmerFlame closed 2 years ago

OmerFlame commented 2 years ago

Current behavior

When using a UINavigationController as the root view controller, you can see the Android-style navigation bar at the top but the content is completely black and doesn't seem to show the root view controller that I set inside the UINavigationController.

Expected behavior

Seeing a normal UINavigationController but with the root view controller actually being shown instead of having a completely black screen below the navigation bar.

Steps to reproduce

  1. Use the sample project and set the root view controller of the window inside AppDelegate.swift to a UINavigationController that has ViewController as its root view controller.
  2. Run it on any supported OS (got the same weird results with Android, macOS Monterey and iOS 15.1).

Screenshots

Screen Shot 2021-11-07 at 18 39 49

Environment

ephemer commented 2 years ago

Thanks for the bug report @OmerFlame. We will have a look in the coming days

ephemer commented 2 years ago

Before I look into this too much - isn't this expected behaviour?

Here the navigation controller would have no view to render, meaning the content of the content view will be transparent and fall through to the "abyss" behind it (which is black by default).

Put differently, what does a "normal" navigation controller that's empty look like? Are you expecting a white background instead?

Edit: sorry, I see that you are setting a rootViewController in the UINavigationController. I will have a look into it

ephemer commented 2 years ago

@OmerFlame I found the issue and made a fix for it in #343. With that patch, wrapping the demo app's ViewController in a UINavigationController works as expected

ephemer commented 2 years ago

@OmerFlame I merged a fix for this. Please let me know if you have any further feedback or questions