     private let statusBarStyle: UIStatusBarStyle
     private var pushingViewController = false
     private var currentNavigationBarOnBack: MessageType? = .none
-    private var onControllerDidShow: () -> Void = { }
+    private var onControllerDidShow: (() -> Void)? = .none
     private var onPop: (() -> Void)? = .none
     
     init(customComponentRenderer: CustomComponentRendererType, layoutEngine: LayoutEngine, statusBarStyle: UIStatusBarStyle = .`default`) {

                                     willShow viewController: UIViewController, animated: Bool) {
        if pushingViewController {
            pushingViewController = false
            onControllerDidShow = { }
        } else if !pushingViewController && topViewController != .none {
            // If a controller is not being pushed and the top view controller
            // is not nil then the navigation controller is poping the top view controller.

            } else if let message = currentNavigationBarOnBack {
                onControllerDidShow = { self.mailbox.dispatch(message: message) }
            } else {
                onControllerDidShow = .none
            }
        }
    }
    
    public func navigationController(_ navigationController: UINavigationController,
                                     didShow viewController: UIViewController, animated: Bool) {
        if let onControllerDidShow = onControllerDidShow {
            onControllerDidShow()
        }
        onControllerDidShow = .none
        onPop = .none
    }
    
}
