react-native-dropdown-picker icon indicating copy to clipboard operation
react-native-dropdown-picker copied to clipboard

TypeError: undefined is not an object (evaluating 'iter[Symbol.iterator]')

Open teo-jun-xiong opened this issue 4 years ago • 3 comments

I have an unknown number of items, so options, pickerOpen, answers, are all arrays of states. The error is shown when I try to select a value, which then calls v(). An element in the options array looks like this: {label: 'abc', value: 'abc}.

<DropDownPicker
    multiple={true}
    min={1}
    max={options[index].length}
    open={pickerOpen[index]}
    setOpen={v => {
    let list = [...pickerOpen];
    list[index] = v;
    setPickerOpen(list);
    }}
    value={answers[index]}
    items={options[index]}
    setValue={v => {
        let list = [...answers];
        list[index] = v();
        setAnswers(list);
    }}
/>

The code I used for setValue worked when for the case where multiple={false}. Appreciate any help!

teo-jun-xiong avatar Jul 11 '21 16:07 teo-jun-xiong

Upon further investigation, it seems like in Picker.js:1081: setValue(state => {, state is undefined. Can I check what's the intended input for state? I tried changing setAnswers(list) to return setAnswers(list) and it returns the same error.

teo-jun-xiong avatar Jul 12 '21 02:07 teo-jun-xiong

any updates on the issue????

yousef71 avatar Jan 17 '22 15:01 yousef71

@yousef71 in open source projects, the comments you see are the updates that exist. You can always dig in to node_modules and see what is going on + post a PR, if there is something wrong

mikehardy avatar Jan 17 '22 15:01 mikehardy

I had the same error on my simulator when using react-native. The error info is like this:

TypeError: null is not an object (evaluating 'iter[Symbol.iterator]')

Because I setValue as null but expected as Array.

samwangdd avatar Nov 09 '22 03:11 samwangdd