Closed zkamisama closed 1 year ago
LazyPager content closures can't respond to variable updates within the closure context
@State var count: Int = 0 var body: some View { ZStack { LazyPager(data: medias, page: $currentIndex ) { media in WebImage(url: media.wrappedCoverImage) .resizable() .aspectRatio(contentMode: .fit) .matchedGeometryEffect(id: media.id!.uuidString, in: transition) .overlay { Text("Count \(count)") .font(.title) } } } .onChange(of: currentIndex) { newValue in count = count + 1 print(count) } }
When the sliding view switches pages, the variable count is updated, but the count value inside the content closure is not updated.
Hi! Thanks so much for the report. Fixed and released in 1.0.4
LazyPager content closures can't respond to variable updates within the closure context
When the sliding view switches pages, the variable count is updated, but the count value inside the content closure is not updated.