Skip to content
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

Two Modal Presentation Issues #92

Closed
mergesort opened this issue Dec 29, 2018 · 5 comments
Closed

Two Modal Presentation Issues #92

mergesort opened this issue Dec 29, 2018 · 5 comments

Comments

@mergesort
Copy link

mergesort commented Dec 29, 2018

I've run into a couple of problems when trying to present view controllers and wanted to raise them in case I'm using the API wrong, or in case it's something that can be fixed. I've attached a sample project with the way to reproduce the issues I'm seeing, running them on an iPhone XS. The three files to look at are KeyboardTestViewController.swift (addition), KeyboardLayoutGuide.swift (addition), and ViewController.swift (modification to add two new test cases - .showFullScreenExampleModal and .showFullScreenKeyboardExampleModal).


The first issue is when presenting a view controller directly to the .full position using the new .present API. The animation doesn't seem to present as smoothly as I would expect, compared to the other options.

To see how this works, run the updated sample project with the "Show Full Screen Example Modal" option (.showFullScreenExampleModal).


The second issue is when presenting a view controller with a UITextField with the .present API. In my case the UITextField is the first responder, and pinned to a a keyboard layout guide, which works perfectly when using UIKit's present viewController API, other third party options, but not when using FloatingPanel. The problem seems to be on initialization of the presentation, as you can see the problem corrects itself when hiding and showing the keyboard (by pressing cmd + k in the simulator, which is obviously not an option on a device).

To see how this works, run the updated sample project with the "Show Full Screen Example Modal" option (.showFullScreenExampleModal).


Let me know if you need any more information, happy to help assess and debug as needed. Thanks for all the hard work @scenee!

@Pivovar63
Copy link

The first is because presented view has no initial frame set. You can do WA with setting initial frame in prepareLayout method like that:

func prepareLayout(surfaceView: UIView, in view: UIView) -> [NSLayoutConstraint] {
        let rect = UIScreen.main.bounds
        view.frame.origin.y = rect.height
        view.frame.size.height = rect.height
        let constraints = [
            surfaceView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0.0),
            surfaceView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0.0)
        ]
        return constraints
    }

@scenee
Copy link
Owner

scenee commented Jan 10, 2019

Thank you for your report, @mergesort! I acknowledge this issue.
And also thank you for your help, @Pivovar63! I confirm your workaround works well.
I will try to fix this issue in the library😃

@mergesort
Copy link
Author

Thank you for being so responsive! I appreciate the effort to integrate it into the library. Based on reading through #104, is it correct to say that @Pivovar63's workaround won't be needed in the future?

@scenee
Copy link
Owner

scenee commented Jan 15, 2019

is it correct to say that @Pivovar63's workaround won't be needed in the future?

Yes, that's right, @mergesort. After merging #104, you don't need the workaround. Your samples just work with the modified library.

@scenee
Copy link
Owner

scenee commented Jan 15, 2019

@mergesort, I closed this issue by merging #104 . But you still have/find a problem, please feel free to reopen this. Thanks for your cooperation 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants