Skip to content

WheelPicker can scroll/select blank area after last item with short finite lists #78

Description

@BenDevelopment

Describe the bug
When using WheelPicker / withVirtualized(WheelPicker) with a short finite list, the picker can scroll past the last item and visually settle on an empty padded row.

This is especially visible with a decimal wheel containing only 10 values (0 to 9) and visibleItemCount={5}. After scrolling down past the last item, blank space can appear in the center selection area, making it look like an empty value is selectable.

Code snippet

import React, {useState} from 'react';
import {View} from 'react-native';
import WheelPicker, {withVirtualized} from '@quidone/react-native-wheel-picker';

const VirtualizedWheelPicker = withVirtualized(WheelPicker);

const data = Array.from({length: 10}, (_, value) => ({
  value,
  label: String(value),
}));

export default function App() {
  const [value, setValue] = useState(0);

  return (
    <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
      <VirtualizedWheelPicker
        data={data}
        value={value}
        onValueChanged={({item}) => setValue(item.value)}
        visibleItemCount={5}
        itemHeight={40}
        width={80}
        enableScrollByTapOnItem
      />
    </View>
  );
}

Repo for reproducing
I do not have a public reproduction repository yet. The snippet above should reproduce the issue in a fresh React Native / Expo app.

To Reproduce
Steps to reproduce the behavior:

  1. Render a WheelPicker or withVirtualized(WheelPicker) with a short finite list, for example values 0 to 9.
  2. Set visibleItemCount={5} and itemHeight={40}.
  3. Scroll down to the last item (9).
  4. Continue dragging or flinging downward.

Expected behavior
The picker should clamp or snap to the last valid item. It should not visually settle on blank padded space below the last item.

Screenshots or video
The issue appears as an empty row below the last value (9) reaching the center selection area.

Environment

  • Desktop OS: Windows 11
  • Device: Pixel 8 Pro emulator
  • OS: Android API 35
  • React Native version: 0.85.3
  • React Native architecture: New architecture / Fabric
  • JS engine: Hermes
  • Library version: 1.7.0

Additional context
I tried locally clamping the scroll offset and disabling native bounce/overscroll, but that affects native inertia and makes the wheel feel unstable.

Ideally, the picker would keep native momentum/inertia but ensure that the final snapped value is always within the valid item range for finite lists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions