-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(iOS): viewhierarchy stability with modals #6370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(iOS): viewhierarchy stability with modals #6370
Conversation
This PR is not cleanest solution however intended to provide suggestion on fix which core team may can address in best way possible. This modification has been tested pretty rigorously and has been found to be the type of fix needed to solve the issue mentioned. |
c1309c6
to
c238bc5
Compare
Ideally we could use https://developer.apple.com/documentation/uikit/uiviewcontroller/1621505-dismissviewcontrolleranimated with the completion handler to ensure it's fully closed in that particular condition. Not sure if worth the trouble since usually this particular condition just needs to fully close (with no animation) before opening again (and the timeout here ensures that as well as appears to fully correct the situation) but perhaps the completion handler's could be used to tighten all this up and avoid race conditions in the most sure fire way. |
@NathanWalker Indeed this fix doesn't look clean. It's not clear how the problem of a My guess is that you are trying to open a modal view on a target that already opened a modal view. The iOS framework doesn't allow this by default and we are currently not supporting this. If indeed this is the case, we can discuss further if this is indeed a desirable behavior. |
Agreed @MartoYankov - I assume that your team also believed a modal needed to be closed in that condition though hence the message you all had in there:
So instead of just logging a message I did just that: closed the current modal. Again it appears to fix it - why it fixes it not sure but it's a definite race condition that I've had trouble reproducing really over the past year to year and half as I've run into from time to time in all sorts of {N} projects. Bottom line I believe is that the message that was there (is there currently alludes to the situation), let's just handle and not let apps fail on that condition. Reproducing it or providing a test for it - I wish I knew - race conditions are tough. |
c238bc5
to
edb9566
Compare
Hey @NathanWalker I have done some tests and managed to reproduce the 1. Open a modal page in the
|
@vakrilov hooray! this is great news thank you so much for digging into this one 🤗 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
PR Checklist
What is the current behavior?
Apps can get a "white screen of death" due to invalid and improper viewController handling on iOS related to modals.
What is the new behavior?
Ensures that a viewController is properly closed in the case one needs to be before opening to avoid app error.
The issue here relates to {N} + Angular however it's tied to this problem in core modules ultimately.
closes NativeScript/nativescript-angular#1546