Dismiss modal ViewController animation works strangely

Overview

When we dismiss a modal ViewController in a specific situation, the dismiss transition works strangely showing a black bar. You can see the following movie and image.

Screenshot:

Movie: https://user-images.githubusercontent.com/12263798/208803342-5183772c-6d31-45df-b09d-719a3aa117e3.mp4

How to reproduce

I'm not sure of the reason, but we can reproduce it in the following conditions:

  1. In A→B(push transition)→C(modal transition) ViewController structure, execute in order :
    1. navigationController.popToRootViewController in B. ( popViewController does not reproduce.)
    2. dismiss in C.
  2. navigationController.navigationBarisTranslucent = false
  3. navigationController.setNavigationBarHidden(true) in A, and navigationController.setNavigationBarHidden(false) in B.

Reproduction project: https://github.com/SShayashiCheckPopToRootAnimation

Environment:

$ /usr/bin/xcodebuild -version
Xcode 14.1
Build version 14B47b

Could you please share any ideas why this animation happen?

Dismiss modal ViewController animation works strangely
 
 
Q