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

Not working with iOS 17.1+ #202

Open
4 of 9 tasks
Arrankar opened this issue Oct 30, 2023 · 18 comments
Open
4 of 9 tasks

Not working with iOS 17.1+ #202

Arrankar opened this issue Oct 30, 2023 · 18 comments

Comments

@Arrankar
Copy link

Arrankar commented Oct 30, 2023

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • 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:

  1. Create controller for present by PanModal
  2. Present that controller by "presentPanModal" func
  3. Look at dark screen without your controller.

Expected result:

Modal controller under dark screen.

Actual result:

Dark screen without modal controller.

Attachments:

Снимок экрана 2023-10-31 в 00 18 58
@Noah-JJ
Copy link

Noah-JJ commented Oct 31, 2023

What should we do?

@Arrankar
Copy link
Author

What should we do?

Start to search new library I guess

@yavl
Copy link

yavl commented Oct 31, 2023

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 😃

@PhanithNY
Copy link

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.

@Pato-Salazar
Copy link

Pato-Salazar commented Nov 1, 2023

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.

@hewang1016729378
Copy link

遇到了同样的问题

@Ashok28
Copy link

Ashok28 commented Nov 2, 2023

Can confirm, that workaround provided by @yavl works. Moving all layout configuration from constructor to viewDidLoad (or other lifecycle methods) fixes the issue.

@Pato-Salazar
Copy link

Does not work for me. Maybe because I have a collectionView in the modal that is being presented??.. Is this library abandoned?...

@yavl
Copy link

yavl commented Nov 2, 2023

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.

@oscarcv
Copy link

oscarcv commented Nov 3, 2023

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

@Pato-Salazar
Copy link

Pato-Salazar commented Nov 3, 2023

@oscarcv this actually works for me as well. Nicely done. Are you cool if I create a PR with your solution?

@oscarcv
Copy link

oscarcv commented Nov 3, 2023

@Pato-Salazar

#204

@Pato-Salazar
Copy link

@oscarcv I tagged the library owners.. if we get lucky they might merge this...thanks again

@Pato-Salazar Pato-Salazar mentioned this issue Nov 3, 2023
3 tasks
yanxiaobing added a commit to yanxiaobing/PanModal that referenced this issue Nov 14, 2023
@abmomen
Copy link

abmomen commented Nov 16, 2023

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

@springfk
Copy link

for iPad it has an issue with your fix @oscarcv, any idea?

@oscarcv
Copy link

oscarcv commented Dec 13, 2023

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.

@Van-Lucky
Copy link

Van-Lucky commented Dec 16, 2023

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?
}

Cuizhangqiang pushed a commit to holla-world/PanModal that referenced this issue Jan 8, 2024
半屏偶尔显示不出来问题fix
@ppave
Copy link

ppave commented Jan 15, 2024

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

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