Releases: richardscarrott/react-snap-carousel
Releases · richardscarrott/react-snap-carousel
v0.2.0
What's Changed
-
Snap point CSS declarations (
scroll-snap-align: start
) are no longer applied automatically. This means by default, a carousel will not snap to a page. #6-
Instead a
Set
of item indexes calledsnapPointIndexes
is provided to allow carousels to render snap points themselves. This change was necessary to ensure DOM updates are only performed by React.Before
const Carousel = () => { const { scrollRef } = useSnapCarousel(); return ( <ul ref={scrollRef}> {Array.from({ length: 16 }).map((item) => ( <li>{item}</li> ))} </ul> ); };
After
const Carousel = () => { const { scrollRef, snapPointIndexes } = useSnapCarousel(); return ( <ul ref={scrollRef}> {Array.from({ length: 16 }).map((item, i) => ( <li style={{ scrollSnapAlign: snapPointIndexes.has(i) ? 'start' : '' }} > {item} </li> ))} </ul> ); };
-
v0.1.0
What's Changed
- #1 Refactor pages algorithm by @richardscarrott in #2
New Contributors
- @richardscarrott made their first contribution in #2
Full Changelog: v0.0.3...v0.1.0
v0.1.0-next.0
What's Changed
- #1 Refactor pages algorithm by @richardscarrott in #2
New Contributors
- @richardscarrott made their first contribution in #2
Full Changelog: v0.0.3...v0.1.0-next.0
v0.0.3
- Add support for vertical axis carousels
Full Changelog: v0.0.2...v0.0.3
v0.0.2
v0.0.1
What's Changed
- Initial implementation ported from internal project
Full Changelog: https://github.com/richardscarrott/react-snap-carousel/commits/v0.0.1