sosog / react-native-dynamically-selected-picker

React Native Picker for Android and IOS with dynamically updating selected items on scroll.
MIT License
113 stars 19 forks source link

Unable to scroll on iOS simulator app #47

Open andrehadianto opened 1 month ago

andrehadianto commented 1 month ago

Here's the code that I'm using. Pretty straightforward and I'm just trying to make it work.

    const [updatedAge, setUpdatedAge] = useState(mortalityAge);
    ...
      <DynamicallySelectedPicker
        transparentItemRows={1}
        items={Array.from({ length: maxAge - age }, (_, i) => {
          const value = i + age + 1;
          return {
            key: value,
            label: value.toString(),
            value: value,
          };
        })}
        onScroll={({ index }) => setUpdatedAge(index)}
        onMomentumScrollBegin={({ index }) => setUpdatedAge(index)}
        onMomentumScrollEnd={({ index }) => setUpdatedAge(index)}
        onScrollBeginDrag={({ index }) => setUpdatedAge(index)}
        onScrollEndDrag={({ index }) => setUpdatedAge(index)}
        initialSelectedIndex={updatedAge - age - 1}
      />
    ...

Below is some reference videos

https://github.com/user-attachments/assets/83df9ee5-1fd4-4e2c-a1b5-1b738f3378ae

https://github.com/user-attachments/assets/c1a99b41-9f47-4028-bc67-9848f2d99bcc

sosog commented 1 month ago

@andrehadianto no errors? maybe you have a transparent container over the scroller?