kolking / react-native-page-indicator

React Native component designed to display the current page of a swiper, slideshow, carousel, and more.
MIT License
37 stars 1 forks source link

[Feature Request] `Pressable` indicators #20

Open utkarsh1097 opened 4 months ago

utkarsh1097 commented 4 months ago

For certain types of indicators (such as "bead"), making them clickable/pressable will help navigating from page 'i' to page 'j' easier.

kolking commented 4 months ago

Thank you very much for writing the issue! Nevertheless, I'm quite sceptical about this. I believe that in the majority of use cases the indicators are too small to precisely tap, so for me this sounds like an unnecessary complication.

utkarsh1097 commented 3 months ago

Thanks for your reply!

I think there are some use cases (for example, the one I explained above), and it can be implemented as a boolean flag (default to false for the reasons you mention).

As far as the implementation detail goes, I think that IndicatorBeads can use Pressable based on whether the boolean flag is set or not. It can be the user's responsibility to pass the onPress callback that manages the state of the active page. (i.e., tapping on the indicator for page 'i' should set the active page to 'i')