react-native-ui-lib icon indicating copy to clipboard operation
react-native-ui-lib copied to clipboard

Picker issue

Open creitmeier701x opened this issue 3 years ago • 0 comments

Description

When using the Picker component it only allows one on multi selection.

Related to

  • [X] Components
  • [ ] Demo
  • [ ] Docs
  • [ ] Typings

Steps to reproduce

simple multi select setup

Expected behavior

Should allow for multiple selections unless i'm doing some thing wrong..

Actual behavior

Press one option then tap second item and first is deselected and second isn't selected either. The third item would then be selected and repeat.

More Info

Code snippet

function Options() {
    const options = useOptions(); //array of objects
    const [selectedOptions, setSelectedOptions] = useState<string[]>([])
    return (
        <View>
            <Picker
            value={selectedOptions}
            placeholder={'Select By Options'}
            mode={PickerModes.MULTI}
            showSearch={true}
            migrateTextField
            onChange={(items:string[]) => setSelectedOptions(items)}
            >
            {options.map((item,i)=>(
                <Picker.Item key={item.id} value={item.id} label={`item: ${i}`}  disabled={false}/>
            ))}
            </Picker>
        </View>
    )
}

Screenshots/Video

issue

Environment

  • React Native version: 0.69.5
  • React Native UI Lib version: 6.21.2

Affected platforms

  • [?] Android
  • [X] iOS
  • [?] Web

creitmeier701x avatar Oct 16 '22 03:10 creitmeier701x