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

ScrollView Nesting Issues. #34

Closed
BenThomasClark opened this issue Jan 12, 2023 · 5 comments
Closed

ScrollView Nesting Issues. #34

BenThomasClark opened this issue Jan 12, 2023 · 5 comments

Comments

@BenThomasClark
Copy link

BenThomasClark commented Jan 12, 2023

Hi,
I saw this post posted in October 2021 regarding issues with nesting the grids inside scroll views. And the answer was that scrollviews were not supported.

Is there any update on this or projected update release dates?

Thanks!

@brendand
Copy link

Have you tried setting .gridContentMode(.scroll)?

That'll put a scrollview around the grid.

@BenThomasClark
Copy link
Author

Hi, yeah, that does work but only limited to the views scope - the grid I'm using needs to be part of a larger view, wrapped in a scrollView.
Thank you for your suggestion though.

@BenThomasClark
Copy link
Author

Closing this issue now as after some investigation, this has been resolved/is invalid.
Anyone looking for an answer - you need to provide the ScrollView with a frame height and can be used in conjunction with a GeometryReader to provide a dynamic height based on content.

@GuilhermeDeconto
Copy link

Closing this issue now as after some investigation, this has been resolved/is invalid.
Anyone looking for an answer - you need to provide the ScrollView with a frame height and can be used in conjunction with a GeometryReader to provide a dynamic height based on content.

@BenThomasClark Could you provide a code snippet for this solution?

@kiecooboi
Copy link

Closing this issue now as after some investigation, this has been resolved/is invalid.
Anyone looking for an answer - you need to provide the ScrollView with a frame height and can be used in conjunction with a GeometryReader to provide a dynamic height based on content.

@BenThomasClark Could you provide a code snippet for this solution?

        GeometryReader {
            let size = $0.size
            ScrollView {
                VStack {                    
                    Grid(tracks: 2) {
                        // ...
                    }
                }
                // .frame(width: size.width, height: size.height, alignment: .leading)  <- You can change the height here or just ignore this line, your `Gird` is now displayed in `ScrollView`
            }
            .scrollIndicators(.hidden)
        }

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

4 participants