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

initialIndex is invalid and Carousel always begin from index 0 #82

Open
skylineman opened this issue Dec 12, 2024 · 0 comments
Open

initialIndex is invalid and Carousel always begin from index 0 #82

skylineman opened this issue Dec 12, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@skylineman
Copy link

skylineman commented Dec 12, 2024

Describe the bug
Carousel always begin from index 0. I tryed your demo, and modified 'initialIndex' from '0' to '2', but it happened same as index '0'.

To Reproduce
Minimum amount of code to reproduce:

CarouselStack(sneakers, initialIndex: 2) { sneaker, translation in
                SneakerCard(sneaker: sneaker, translation: translation)
            }
            .carouselScale(0.7)
            .carouselPadding(horizontalSizeClass == .compact ? 20 : 40)
            .carouselSpacing(horizontalSizeClass == .compact ? 10 : 30)
            .carouselStyle(.infiniteScroll)
            .onCarousel { context in
                withAnimation(.easeInOut(duration: 0.2)) {
                    isShowItems = false
                }
                DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
                    withAnimation(.easeInOut(duration: 0.2)) {
                        sneaker = sneakers[context.index]
                        isShowItems = true
                    }
                }
            }

Device information (please complete the following information):

  • Device: iPhone15 Pro and iPhone16 Simulator
  • OS: iOS8.1
  • Xcode version: 16.1
  • Swift version: 6.0.2

Thanks your work and hope reply.

@skylineman skylineman added the bug Something isn't working label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants