Skip to content

Releases: richardscarrott/react-snap-carousel

v0.2.0

02 Feb 16:23
Compare
Choose a tag to compare

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 called snapPointIndexes 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

18 Jan 11:57
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.0.3...v0.1.0

v0.1.0-next.0

18 Jan 11:57
Compare
Choose a tag to compare
v0.1.0-next.0 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: v0.0.3...v0.1.0-next.0

v0.0.3

18 Jan 11:56
Compare
Choose a tag to compare
  • Add support for vertical axis carousels

Full Changelog: v0.0.2...v0.0.3

v0.0.2

18 Jan 11:56
Compare
Choose a tag to compare

What's Changed

  • Remove debug code

Full Changelog: v0.0.1...v0.0.2

v0.0.1

18 Jan 11:55
Compare
Choose a tag to compare

What's Changed

  • Initial implementation ported from internal project

Full Changelog: https://github.com/richardscarrott/react-snap-carousel/commits/v0.0.1