SelectedIndex cannot be chose. On change won't trigger
Closed this issue · 2 comments
mhackeras commented
When for example selectedIndex={0} and you choose that, onChange is not gonna trigger.
The bug lies exactly on the thing you cannot select that one value that was set as selectedIndex
erksch commented
I am not sure I understand your problem.
selectedIndex
should be a controlled property that is connected with onChange
as described in the README:
function CityPicker() {
const [selectedIndex, setSelectedIndex] = useState(0);
return (
<WheelPicker
selectedIndex={selectedIndex}
options={['Berlin', 'London', 'Amsterdam']}
onChange={(index) => setSelectedIndex(index)}
/>
);
}
If you hardcode the selectedIndex
you propably doing something wrong.
mhackeras commented
I think you are right.
Was testing it and yes hardcoded it.