Skip to content

fix: interpolate without mirroring the ends when infinite scroll is off - #34

Merged
petrkonecny2 merged 1 commit into
mainfrom
fix/interpolate-without-infinite-scroll
Oct 10, 2026
Merged

petrkonecny2 merged 1 commit into
mainfrom
fix/interpolate-without-infinite-scroll

Conversation

@petrkonecny2

@petrkonecny2 petrkonecny2 commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Description

useInterpolateInsideCarousel gives wrong values when infinite scroll is disabled and there are three or more slides.

interpolateInsideCarousel always assumes the first and last rendered slides are clones. Its getAdjustedIndex maps slide 0 to total - 2, slide 1 to total - 1 and the last slide to 1, then gives the slide its thisValue at that index too. With disableInfiniteScroll there 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 gets thisValue instead of valueBefore. A side-scale effect then shows the first card at full size next to the current one.

  • The helper takes an optional isInfinite argument, defaulting to true so direct callers behave as before, and only mirrors the ends when it's on.
  • The hook reads disableInfiniteScroll from the provider and passes it through.

Testing: type:check, lint, Prettier and test. 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

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>
@petrkonecny2
petrkonecny2 merged commit be03328 into main Oct 10, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
npm — 4d4288d3 Deployed Oct 10, 2026 by petrkonecny2 via Publish #58
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

Successfully merging this pull request may close these issues.

1 participant