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

Parallax view shrinking inside a ScrollView #2

Open
Saim-Khan1 opened this issue Apr 11, 2023 · 0 comments
Open

Parallax view shrinking inside a ScrollView #2

Saim-Khan1 opened this issue Apr 11, 2023 · 0 comments

Comments

@Saim-Khan1
Copy link

Saim-Khan1 commented Apr 11, 2023

Hi there,

I have a ZStack containing some images with varying amounts of parallax inside a vertical ScrollView. On launch it all appears fine, however if I scroll up and down a few times one of the parallax layers (or the outer ZStack) seems to shrink randomly.

It's meant to look like this:
image

But ends up looking like this:
image

Also sometimes it fixes itself and pops back to the original size, other times it stays in that shrunken state.

Any ideas what may be causing this? Here is the code for reference:

ScrollView(.vertical, showsIndicators: false) {           
                VStack(spacing: 0) {
                    ZStack {
                        Image("Background")
                            .resizable()
                            .aspectRatio(contentMode: .fit)
                            .parallax(amount: 16)
                            .frame(width: 130)
                            .padding()
                        
                        
                        Rectangle()
                            .frame(width: 130, height: 130)
                            .foregroundColor(.clear)
                            .padding()
                        
                        Image("BorderLayer")
                            .resizable()
                            .aspectRatio(contentMode: .fit)
                            .parallax(amount: 15)
                            .frame(width: 110)
                            .padding()
                        
                        Image("IconLayer")
                            .resizable()
                            .aspectRatio(contentMode: .fit)
                            .parallax(amount: 10)
                            .frame(width: 75)
                            .padding()
                        
                    }
...

Any help would be much appreciated! Thanks a lot

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