quidone / react-native-wheel-picker

Wheel Picker for React Native
MIT License
52 stars 10 forks source link

Feature: number of visible items #9

Closed Alaa-Ben closed 2 weeks ago

Alaa-Ben commented 1 month ago

Hey there !

Is it possible to configure the number of visible items ? It seems like it's 5 by default (2 above, the selected one, then 2 below). Is it possible to customise it to get it down to for example 3 ? (one above, the selected one, and the one below)

Thanks !

rozhkovs commented 1 month ago

Hi @Alaa-Ben!

There is no easy way to do this yet, but you can use a more complex way for any animation: override the renderItemContainer and calculate animation rules for each index based on the useScrollContentOffset and your data.

Alaa-Ben commented 1 month ago

Thanks for the reply! I've checked the source code and I see some occurrences of hard coded fives, etc.

Do you think making it customisable is interesting enough to make it a feature in this lib ?

rozhkovs commented 1 month ago

Do you think making it customisable is interesting enough to make it a feature in this lib ?

Yes, it seems to me that this will be a useful feature!

Speaking from the point of view of the public API, it seems that it would be nice to provide the ability to simply specify the visible faces of the drum, for example, 3, 5, 7, etc.

But these are my first thoughts so far, maybe you have better ideas!

Alaa-Ben commented 1 month ago

Yeah that would be the idea, just a configurable number of visible items 👍 (Depending on your needs, currently 5 might be too much as it takes up too much space on the screen)

rozhkovs commented 2 weeks ago

@Alaa-Ben Released in 1.1.0!)

Alaa-Ben commented 2 weeks ago

Love it, very helpful thanks a lot !