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

Bottomsheet initial position wrong #64

Open
minhson95th opened this issue Jun 3, 2021 · 2 comments
Open

Bottomsheet initial position wrong #64

minhson95th opened this issue Jun 3, 2021 · 2 comments

Comments

@minhson95th
Copy link

minhson95th commented Jun 3, 2021

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

@shoaibahmaddx
Copy link

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

@dzungpv
Copy link

dzungpv commented Mar 21, 2023

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.

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