react-snap-carousel icon indicating copy to clipboard operation
react-snap-carousel copied to clipboard

Minor confusion with docs when you need pages with single element

Open dzebisati opened this issue 1 year ago • 2 comments

Hello!

First of all, thank you for creating and sharing this library! I’m really impressed with the depth and care you’ve brought to this project, especially in delivering a native solution that meets such a significant community need 👏🏻. The attention to detail is remarkable, and it’s clear how much effort and expertise went into making this possible.

When you need to use "single element page" functionality there can be some initial confusion. Developers may mistakenly think that the carousel is unsuitable for this specific use case, because there is no such options in API and page size are dynamically determined by the DOM layout.

It turns out, though, that this is easily resolved with the data-should-snap attribute, which perfectly handles such cases.

Clarifying this feature in the docs and maybe highlight in storybook could help users realize the full potential of this library.

Thank you again for all your hard work on this project!

dzebisati avatar Nov 12 '24 16:11 dzebisati

Hi @dzebisati,

Well done for a) finding the feature and b) figuring out a use for it as I appreciate it's not documented beyond this PR #27.

I presume your use case is to display multiple items at a time but have users scroll just one at a time? We could add a storybook example of this (PR welcome).

More broadly, I'd like to improve the docs at some stage so I'll consider this issue when I do.

richardscarrott avatar Nov 13 '24 09:11 richardscarrott

Hi @richardscarrott,

I’ve noticed a small issue that occurs when a user defines their own “page” logic using the data-should-snap attribute. In some cases, the prev method stops working as expected.

I’ve prepared a sandbox and submitted a PR to address this issue locally.

If my PR is valid after your review, feel free to mention me for the Storybook PR. Thank you once again for this brilliant tool, and have a Happy New Year!

dzebisati avatar Dec 31 '24 09:12 dzebisati