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

Buttons wrapped in ScrollView do not work. #6

Closed
lisindima opened this issue Feb 11, 2020 · 3 comments
Closed

Buttons wrapped in ScrollView do not work. #6

lisindima opened this issue Feb 11, 2020 · 3 comments

Comments

@lisindima
Copy link

When this modal window appears, the buttons are not active, in order for the buttons to start working, you need to interact with scrollview, after that a modal view will jump (it will decrease by a few pixels) and the buttons will become active, I hope I explained it clearly) I also attach an example code from your project.

.partialSheet(presented: $showPartialSheet, backgroundColor: Color(UIColor.secondarySystemBackground)) {
     ChangeIcons()
}

struct ChangeIcons: View {
    var body: some View {
        ScrollView(.horizontal, showsIndicators: false) {
            HStack {
                VStack(alignment: .center) {
                    Button(action: foofunc) {
                        Image("infoApp")
                            .resizable()
                            .renderingMode(.original)
                            .cornerRadius(15)
                            .frame(width: 80, height: 80)
                            .overlay(
                                RoundedRectangle(cornerRadius: 15)
                                    .stroke(Color.red, lineWidth: 3)
                                    .frame(width: 90, height: 90)
                        )
                    }.frame(width: 95, height: 95)
                    Text("Стандартная")
                        .font(.system(size: 11, design: .rounded))
                        .bold()
                }
                VStack(alignment: .center) {
                    Button(action: fooFunc) {
                        Image("altIconApp")
                            .resizable()
                            .renderingMode(.original)
                            .cornerRadius(15)
                            .frame(width: 80, height: 80)
                            .overlay(
                                RoundedRectangle(cornerRadius: 15)
                                    .stroke(Color.red, lineWidth: 3)
                                    .frame(width: 90, height: 90)
                        )
                    }.frame(width: 95, height: 95)
                    Text("Автор иконки")
                        .font(.system(size: 11, design: .rounded))
                        .bold()
                }
            }.padding(.horizontal)
        }.onAppear(perform: fooFunc)
    }
}
@lisindima
Copy link
Author

Hello, do you have any results in this investigation?

@ElyesDer
Copy link

Hello, do you have any results in this investigation?

I did investigate the problem. The ZStack's offset inside func sheet()-> some View. Commenting that line will fix the gesture response problem but the partial's position will be affected. One workaround will be the UIViewRepresentable which worked great and no issue for me.

@AndreaMiotto
Copy link
Owner

Like I wrote in the README the component does not work with the scroll view. At the moment SwiftUI does not allow you the access to the scroll view delegates so it will not be possible atm to make an integration. Feel Free to make a pull request if you have found any solution.

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