turbolinks / turbolinks-ios

Native iOS adapter for building hybrid apps with Turbolinks 5
MIT License
881 stars 92 forks source link

Freeze after dismissing a custom transition #74

Closed rayfix closed 7 years ago

rayfix commented 8 years ago

Hi! Sorry I don't have a good test case for this yet. I am noticing that if I try to create a custom navigation transition and use:

viewController.modalPresentationStyle = .OverCurrentContext

After the modal VisitableViewController controller is dismissed, the VisitableViewController on the top of the navigation stack is frozen. If I inspect the view hierarchy after the dismissal I see:

screen shot 2016-10-14 at 3 15 01 pm

At this point I am dead in the water.

On the other hand. If I do not set the modalPresentationStyle everything works (except instead of the previous view controller, the background is totally black as expected)

screen shot 2016-10-14 at 3 22 36 pm

If I go outside of Turbolinks, I don't see any problems. I have run out of things to try. If anyone has any insights on what I might try to do restore the web view properly, I am all ears. Thanks.

zachwaugh commented 7 years ago

The problem here is that Turbolinks only uses a single, shared web view for all screens. When the modal is loaded, it takes the web view from the main screen, and loads it in the modal. When the modal is presented with .overCurrentContext, it doesn't fire the viewWillAppear/Disappear methods on the presenting controller. That means that Turbolinks doesn't know the screen has changed and to issue a new visit to the presenting controller when the modal is dismissed.

There isn't really a great solution here. You can use your own delegate/notifications to call visitableDelegate?.visitableViewWillAppear(self) and visitableDelegate?.visitableViewDidAppear(self) manually just in this case, or use a separate Turbolinks session for the modal screens.