Repository navigation
fix: interpolate without mirroring the ends when infinite scroll is off - #34
Merged
Merged
Conversation
interpolateInsideCarousel always treated the first and last slides as clones, so with infinite scroll disabled and three or more slides, the first two slides also took their current value near the end of the carousel. useInterpolateInsideCarousel now passes whether infinite scroll is on, and the helper only mirrors the ends when it is. It still defaults to on for direct callers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
useInterpolateInsideCarouselgives wrong values when infinite scroll is disabled and there are three or more slides.interpolateInsideCarouselalways assumes the first and last rendered slides are clones. ItsgetAdjustedIndexmaps slide 0 tototal - 2, slide 1 tototal - 1and the last slide to1, then gives the slide itsthisValueat that index too. WithdisableInfiniteScrollthere are no clones, so those slides take their current value while they're actually pages away. For example, with three slides on slide 1, slide 0 getsthisValueinstead ofvalueBefore. A side-scale effect then shows the first card at full size next to the current one.isInfiniteargument, defaulting totrueso direct callers behave as before, and only mirrors the ends when it's on.disableInfiniteScrollfrom the provider and passes it through.Testing:
type:check,lint, Prettier andtest. There are 5 new cases for the non-infinite path. The existing 28 pass unchanged, so the infinite-scroll behaviour is the same.Related Tickets/Issues
Found while moving the Ascension app's parishes carousel side scaling onto
useInterpolateInsideCarousel.🤖 Generated with Claude Code
📦 Published PR as canary version:
0.1.17--canary.34.4d4288d.0✨ Test out this PR locally via:
npm install @strv/react-native-hero-carousel@0.1.17--canary.34.4d4288d.0 # or yarn add @strv/react-native-hero-carousel@0.1.17--canary.34.4d4288d.0