react-native-woodpicker icon indicating copy to clipboard operation
react-native-woodpicker copied to clipboard

Can't select first item on Android when isNullable={false}

Open ac3charland opened this issue 3 years ago • 12 comments

When on Android and using the <Picker/> component, if the isNullable prop is set to false or left as default, when the user selects the first item in the list, it doesn't trigger the onItemChange function and the value stays as the placeholder.

If you select any other item, the picker behaves correctly. Once you've done this, you can select the first item and the picker again behaves correctly.

ac3charland avatar Sep 14 '21 21:09 ac3charland

Hello, Sorry for this late answer. Could you describe a repro? when you mount the picker, the item props is the first element of the items props array?

thodubois avatar Sep 23 '21 11:09 thodubois

Hello, I currently have this issue as well. the onItemChange does not fire when you select the first item in your defined list.

Fiyifoluwa avatar Oct 28 '21 14:10 Fiyifoluwa

Ok, just found the cause. It's a bad behavior. if "isNullable" is false and item prop is null => the first element of the list is selected but there is an issue with the placeholder not showing the label.

I'm going to fix the placeholder.

thodubois avatar Nov 01 '21 21:11 thodubois

Hello, it should be good on 0.3.13 =)

thodubois avatar Nov 02 '21 07:11 thodubois

@thodubois I still have this problem.

maiconcosta avatar Dec 08 '21 22:12 maiconcosta

@maiconcosta Hello could you explain your behavior and give your package version and repro =)

thodubois avatar Dec 19 '21 10:12 thodubois

@thodubois , I am having the same issue too, even in the latest version 0.3.17, here is the example code I am using in my project.

<Picker
  item={{label: "", value: ""}}
  items={[
    {label: "a", value: "a"},
    // {label: "b", value: "b"},
  ]}
  placeholder={"Please Select"}
  onItemChange={(value) => {
    // wont trigger when items have only one object
    console.log(value);
  }}
  isNullable={false}
/>

yeong0809 avatar Dec 24 '21 09:12 yeong0809

Hi, I'll take a look asap =)

thodubois avatar Jan 03 '22 17:01 thodubois

Tengo el mismo problema en 0.3.17

Psegovia2 avatar Mar 17 '22 05:03 Psegovia2

No puedo seleccionar el primer item del picker, cuando selecciono el segundo item y despues el primero ahi si funciona perfectamente alguna ayuda con eso 0.3.17

Psegovia2 avatar Mar 17 '22 05:03 Psegovia2

same issue here, on 0.3.17

FacundoLastra avatar May 13 '22 13:05 FacundoLastra

Any update here? I am having the same issue. I have to select the 2nd item and then come back to the first one in order for the form to pick up the first item value.

I am on ios.

logicman avatar May 25 '22 11:05 logicman