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

[BUG] Problem with Drag Detents #154

Open
alina-p-k opened this issue Nov 3, 2024 · 0 comments
Open

[BUG] Problem with Drag Detents #154

alina-p-k opened this issue Nov 3, 2024 · 0 comments
Assignees
Labels

Comments

@alina-p-k
Copy link
Collaborator

Prerequisites

  • ✅ I checked the documentation and found no answer
  • ✅ I checked to make sure that this issue has not already been filed

Expected Behavior

  1. Presenting view that takes the whole heigh but not the full screen
  2. Stable ability to change height of a view according to Drag Detent values in config
  3. During changing a view height it doesn't ignore using of Spacer and content that supposed to be on the top / bottom of the view stays there.

Please describe the behavior you are expecting

Current Behavior

  1. If i'm using Spacer in a view and use .large Drag Detent case it tries to set the height to full screen.
  2. If i'm using Spacer in a view and use .large Drag Detent case sometimes drag action leads to dismissing view instead of height change.
  3. If i'm using Spacer in a view and drag view to change height it leads to ignoring a Spacer value and view's content stays on the bottom, however sometimes it recalculates Spacer height correctly.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Make an instance of TestDragDetentView and present it
  2. Try to drag view down and back

Code Sample

Example built with using Demo app Popups Demo

struct TestDragDetentView: TopPopup {
    var body: some View {
        VStack(spacing: 0) {
            createBrandingContent()
            Spacer.width(40).background(Color.red)
            createButton()
            createDragIndicator()
        }
        .padding(.horizontal, 28)
    }
    func configurePopup(config: TopPopupConfig) -> TopPopupConfig {
        config
            .dragDetents([.fraction(1.4), .large])
            .cornerRadius(24)
            .heightMode(.auto)
    }
}

private extension TestDragDetentView {
    func createBrandingContent() -> some View {
        BrandingContent()
            .setAppearance(.nonCompact)
            .padding(.top, 32)
            .padding(.bottom, 20)
    }
    func createButton() -> some View {
        Buttons.dismiss
            .getView()
            .setHeight(to: .small)
    }
    func createDragIndicator() -> some View {
        RoundedRectangle(cornerRadius: 42)
            .fill(Color.borderSecondary)
            .frame(width: 40, height: 4, alignment: .center)
            .padding(.top, 12)
            .padding(.bottom, 16)
    }
}

Videos

https://github.com/user-attachments/assets/cab9963f-c289-40f6-b81a-ceea1257ea17
https://github.com/user-attachments/assets/a41f429f-504c-449b-9802-4b1947e8ecb2

Context

It works stable if i'm not using Spacer. Probably Spacer doesn't allow to count view's size correctly.
It has problems for both: top and bottom popup

Name Version
SDK 3.0.0
Xcode 16.1
Operating System iOS 18.1
Device iPhone 16
@FulcrumOne FulcrumOne changed the title Problem with Drag Detents [BUG] Problem with Drag Detents Nov 3, 2024
@FulcrumOne FulcrumOne added the bug label Nov 3, 2024
@FulcrumOne FulcrumOne moved this to Backlog in Popups Roadmap Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

2 participants