navigation-stack icon indicating copy to clipboard operation
navigation-stack copied to clipboard

[Issue] Problem when drag and release instantly, not swipe back view

Open qhu91it opened this issue 6 years ago • 2 comments

I found this issue when swiping back and release instantly so it keeps in current view, and then push to a new view, navigation stack facing this issue. Detail please see the gif.

navigationstack error

qhu91it avatar May 21 '18 10:05 qhu91it

@qhu91it : can fix like that:

public func navigationController(_ navigationController: UINavigationController,
                                     willShow viewController: UIViewController,
                                     animated: Bool) {

        stackDelegate?.navigationController?(navigationController, willShow: viewController, animated: animated)

        if navigationController.viewControllers.count > screens.count + 1 {
            screens.append(view.takeScreenshot())
        }
//        else
//        if navigationController.viewControllers.count == screens.count && screens.count > 0 {
//            screens.removeLast()
//        }
    }
    
    public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
        stackDelegate?.navigationController?(navigationController, didShow: viewController, animated: animated)
        if navigationController.viewControllers.count == screens.count && screens.count > 0 {
            screens.removeLast()
        }
    }

in file : NavigationStack.swift from line 110

dung00275 avatar Jul 03 '19 10:07 dung00275

@qhu91it hi thanks, Could you create Pull Request with a fix?

0ber avatar Jul 04 '19 06:07 0ber