Not working with iOS 17.1+
Description
Describe your issue here.
What type of issue is this? (place an x in one of the [ ])
- [x] bug
- [ ] enhancement (feature request)
- [ ] question
- [ ] documentation related
- [ ] testing related
- [ ] discussion
Requirements (place an x in each of the [ ])
- [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
- [x] I've read and agree to the Code of Conduct.
- [x] I've searched for any related issues and avoided creating a duplicate issue.
Bug Report
Modal controller don't present on iOS 17.1 and upper.
Reproducible in:
PanModal version: 1.2.7
iOS version: 17.2 beta
Steps to reproduce:
- Create controller for present by PanModal
- Present that controller by "presentPanModal" func
- Look at dark screen without your controller.
Expected result:
Modal controller under dark screen.
Actual result:
Dark screen without modal controller.
Attachments:
What should we do?
What should we do?
Start to search new library I guess
Yeah, I can also reproduce this on iOS 17.1. The strange thing was that some ViewControllers were showing up and some were not. Then I realized that the view controller won't show up on presentPanModal if you add subviews / set up auto layout constraints in init(), so in my particular case the fix was just to move addSubview, snp.makeConstraints code to override func viewDidLoad().
No need to search new library 😃
If you embedded viewController inside UINavigationController, try below code:
let modalVC = SheetViewController()
let navigationController = UINavigationController()
// This isn't work
// let navigationController = UINavigationController(rootViewController: modalVC)
navigationController.setViewControllers([modalVC], animated: false)
presentPanModal(navigationController)
Hope this help.
Same issue here. The interesting part is that if click on the hierarchy button I see the controller I am trying to present. It is part of the hierarchy.
遇到了同样的问题
Can confirm, that workaround provided by @yavl works. Moving all layout configuration from constructor to viewDidLoad (or other lifecycle methods) fixes the issue.
Does not work for me. Maybe because I have a collectionView in the modal that is being presented??.. Is this library abandoned?...
Does not work for me. Maybe because I have a collectionView in the modal that is being presented??.. Is this library abandoned?...
if you are presenting UICollectionViewController, try making minimal reproducible example with UIViewController + UICollectionView on it instead and see if that helps.
From the tests I have performed the problem appears in the addRoundedCorners function of the PanModalPresentationController class.
func addRoundedCorners(to view: UIView) {
let radius = presentable?.cornerRadius ?? 0
let path = UIBezierPath(roundedRect: view.bounds, // Bounds value is .zero
byRoundingCorners: [.topLeft, .topRight],
cornerRadii: CGSize(width: radius, height: radius))
// Draw around the drag indicator view, if displayed
if presentable?.showDragIndicator == true {
let indicatorLeftEdgeXPos = view.bounds.width/2.0 - Constants.dragIndicatorSize.width/2.0
drawAroundDragIndicator(currentPath: path, indicatorLeftEdgeXPos: indicatorLeftEdgeXPos)
}
// Set path as a mask to display optional drag indicator view & rounded corners
let mask = CAShapeLayer()
mask.path = path.cgPath
view.layer.mask = mask
//Improve performance by rasterizing the layer
view.layer.shouldRasterize = true
view.layer.rasterizationScale = UIScreen.main.scale
}
Because when creating the panContainerView object, containerView is nil
private lazy var panContainerView: PanContainerView = {
let frame = containerView?.frame ?? .zero // ContainerView is nill
return PanContainerView(presentedView: presentedViewController.view, frame: frame)
}()
To solve the problem, we add in line 179, to the frame calculation if it is zero
override public func presentationTransitionWillBegin() {
guard let containerView = containerView
else { return }
// Fix bug issue
if self.panContainerView.frame == .zero {
self.adjustPresentedViewFrame()
}
...
I hope it will be of help
@oscarcv this actually works for me as well. Nicely done. Are you cool if I create a PR with your solution?
@Pato-Salazar
https://github.com/slackhq/PanModal/pull/204
@oscarcv I tagged the library owners.. if we get lucky they might merge this...thanks again
Got same issue, on iOS 17.1.1, 14 pro max
In our case it showing up for first time and after that only dark screen, if we try to open modal multiple times
for iPad it has an issue with your fix @oscarcv, any idea?
for iPad it has an issue with your fix @oscarcv, any idea?
@springfk If you provide me with a test app to reproduce the problem, I try to review it.
fix problem with iOS 17.1 /// action
lazy var workingVC = WorkingTimeViewController() let navigationController = navigationVC()| navigationController.setViewControllers([workingVC], animated: false)
/// need create class type UINavigationController class navigationVC: UINavigationController, PanModalPresentable { var panscrollable: UIScollView? }
Faced the same issue but with using PanModal for UIPageViewController. Created a PR here, tested on iPhone and iPad. Please test on your side if you can. Thanks