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

Weird bottom sheet width when app's in split screen on landscape iPad #94

Closed
sdtaheri opened this issue Aug 19, 2022 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@sdtaheri
Copy link

Describe the bug
In BottomSheetView+Calculations.swift, in width(with:), the logic doesn't look right. If the iPad is in landscape mode, and you put the app in split screen mode, the code goes into UIDevice.current.orientation.isLandscape block and sets the bottom sheet width to %40 of the app width.

Minimal reproduce-able code
I paste the problematic function:

    // For iPhone landscape, iPad and Mac support
    func width(with geometry: GeometryProxy) -> CGFloat {
#if os(macOS)
        // On Mac use 30% of the width
        return geometry.size.width * 0.3
#else
        if self.isIPadOrMac {
            // On iPad use 30% of the width
            return geometry.size.width * 0.3
        } else if UIDevice.current.orientation.isLandscape {
            // On iPhone landscape use of the 40% width
            return geometry.size.width * 0.4
        } else {
            // On iPhone portrait use of the 100% width
            return geometry.size.width
        }
#endif
    }

Expected behavior
I believe the sheet should follow the horizontal size class on iPad. The ideal would be to set a minimum width as an option.

Screenshots
Simulator Screen Shot - iPad Pro (11-inch) (3rd generation) - 2022-08-19 at 18 14 24

Target version

  • Environment: iPad, Catalyst, iOS app on the Mac and macOS
  • Version: 15.6
@lucaszischka lucaszischka added the bug Something isn't working label Aug 19, 2022
@jeffphp
Copy link

jeffphp commented Apr 21, 2023

If you want the BottomSheet to take all the available width in landscape mode, you can use

BottomSheet{...}.sheetWidth(.relative(1))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants
@jeffphp @sdtaheri @lucaszischka and others