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 · 0 comments
Open

Content change when drag BottomSheet #155

baronha opened this issue Feb 29, 2024 · 0 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.

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

1 participant