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

Grid missing inside scrollview #49

Closed
gandarain opened this issue Nov 27, 2020 · 2 comments
Closed

Grid missing inside scrollview #49

gandarain opened this issue Nov 27, 2020 · 2 comments

Comments

@gandarain
Copy link

Hi, thanks for this library.

I want to ask you something,
When I put WaterfallGrid inside scrollview, the grid just disappears.
How I can fix that?

var body: some View {
        GeometryReader { geometry in
            ScrollView(.vertical) {
                Text("Hello")
                WaterfallGrid((0..<10), id: \.self) { index in
                  Image("swift_logo")
                    .resizable()
                    .aspectRatio(contentMode: .fit)
                }
                .gridStyle(
                  columnsInPortrait: 2,
                  columnsInLandscape: 3,
                  spacing: 8,
                  padding: EdgeInsets(top: 16, leading: 8, bottom: 16, trailing: 8),
                  animation: .easeInOut(duration: 0.5)
                )
                .scrollOptions(
                  direction: .horizontal,
                  showsIndicators: true
                )
                Text("Hello")
            }
        }
    }

Screen Shot 2020-11-28 at 02 04 04

@paololeonardi
Copy link
Owner

paololeonardi commented Dec 3, 2020

Hi @gandarain I just release a new update where the internal ScrollView was removed from the grid view and it should fix your issue.

Please try again your code now, but also keep in mind the scroll direction need to match here:

ScrollView(.horizontal) {
   ...
   WaterfallGrid(...) {
      ...
   }
   ...
   .scrollOptions(direction: .horizontal)
   ...
   }
}

@gandarain
Copy link
Author

Great, thanks you.

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