UBottomSheet icon indicating copy to clipboard operation
UBottomSheet copied to clipboard

Bottomsheet initial position wrong

Open minhson95th opened this issue 4 years ago • 2 comments

In ViewController i've set

    override func viewWillLayoutSubviews() {
        guard sheetCoordinator == nil else {return}
        sheetCoordinator = UBottomSheetCoordinator(parent: self)
    }

and when click button in ViewController

 let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "PAHT_MoiTruongViewController") as! PAHT_MoiTruongViewController
        vc.sheetCoordinator = sheetCoordinator
        vc.dataSource = MyDataSource()
        sheetCoordinator.addSheet(vc, to: self)

and MyDataSource()

class MyDataSource: UBottomSheetCoordinatorDataSource {
    func sheetPositions(_ availableHeight: CGFloat) -> [CGFloat] {
        return [0.1, 0.6, 0.91].map{$0*availableHeight}
    }
    
    func initialPosition(_ availableHeight: CGFloat) -> CGFloat {
        return availableHeight*0.1
    }
}

but when initial sheet first time, position of sheet show wrong look like this image but when i drag up, it can expand look like this, and that is what i want. image How can i fix it? Thank in advance

minhson95th avatar Jun 03 '21 07:06 minhson95th

@minhson95th did you ever manage to fix this issue? I am getting this error as well. @OfTheWolf please your verdict on this issue?

shoaibahmaddx avatar Jul 01 '22 04:07 shoaibahmaddx

I have the issue too, on iOS 16, iPhone 14, whatever value greater 0.7 does not work, I want it expand to the top.

dzungpv avatar Mar 21 '23 05:03 dzungpv