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

Content change when drag BottomSheet #155

Open
baronha opened this issue Feb 29, 2024 · 2 comments
Open

Content change when drag BottomSheet #155

baronha opened this issue Feb 29, 2024 · 2 comments

Comments

@baronha
Copy link

baronha commented Feb 29, 2024

Describe the bug
The height of the content is changed when I drag it.

Minimal reproduce-able code

        .bottomSheet(bottomSheetPosition: self.$showSheet, switchablePositions: [.dynamic], headerContent: {
            BottomSheetHeader(title: "Cancel!")
                .padding(.m)
        }, mainContent: {
            ConfirmSheet(
                onBack: {
                    self.showSheet = .hidden
                    self.dismiss()
                },
                saveDraft: {
                },
                saving: .constant(false)
            )
        })

        .showDragIndicator(false)
        .enableContentDrag(false)
        .showCloseButton(false)
        .enableSwipeToDismiss()
        .enableTapToDismiss()
        .enableBackgroundBlur()
        .backgroundBlurMaterial(.systemDark)
        .background(Color.backgroundLight)
    }
  • Content:
struct ConfirmSheet: View {
    var onBack: () -> Void
    var saveDraft: () -> Void
    @Binding var saving: Bool

    var body: some View {
        VStack(alignment: .leading, spacing: .m) {
            VStack {
                Text("You're editing a great photo. Do you want to save a draft of it before leaving the editor?")
                    .font(.regular(.m))
            }

            VStack(alignment: .leading, spacing: .l) {
                Button {
                    dismiss()
                } label: {
                    HStack {
                        Iconoir.icon(.sparks)
                        Text("Continue editing").font(.regular())
                    }
                }

                Button {
                    self.saveDraft()
                } label: {
                    HStack {
                        HStack {
                            Iconoir.icon(.cloudDownload)
                            Text("Leave & Save Draft").font(.regular())
                        }
                        Spacer()
                        if self.saving == true {
                            ProgressView().tint(.black)
                        }
                    }
                }
                .onChange(of: self.saving) { saving in
                    if saving == false {
                        DispatchQueue.main.async {
                            dismiss()
                            AlertKitAPI.present(
                                title: "Saved to your Binsoo draft!",
                                icon: .custom(UIImage(named: Iconoir.cloudDownload.rawValue)!),
                                style: .iOS17AppleMusic,
                                haptic: .success
                            )
                        }
                    }
                }

                Divider().padding(.vertical, .xxs)

                Button {
                    self.onBack()
                } label: {
                    HStack {
                        Iconoir.icon(.fastArrowLeft)
                        Text("Leave").font(.regular())
                    }
                }.foregroundColor(.red)
            }
            .disabled(self.saving)
            .foregroundColor(.black)
            .padding(.top, .m)
        }
        .padding(.m)
        .padding(.bottom, .paddingBottom)
    }
}

Expected behavior
Works perfectly

Screenshots

Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-03-01.at.00.34.19.mp4

Target version

  • Environment: iOS 17.0,
  • Version: 3.1.1

Additional context
Add any other context about the problem here.

@abhi-sriv
Copy link

I am facing a similar issue where I have a List view in the bottom sheet and on every collapse and retract the list view Jitters terribly and I can't take my app to production if this issue persists.
@baronha were you able to find a fix for your issue?

@baronha
Copy link
Author

baronha commented Jul 29, 2024

I am facing a similar issue where I have a List view in the bottom sheet and on every collapse and retract the list view Jitters terribly and I can't take my app to production if this issue persists. @baronha were you able to find a fix for your issue?

I found the perfect solution.
I switched to this library: PopupView
and it’s 100 times, no, 1000 times better.

https://x.com/_baronha/status/1764880476567920951

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

2 participants