react-native-dropdown-picker
react-native-dropdown-picker copied to clipboard
TypeError: undefined is not an object (evaluating 'iter[Symbol.iterator]')
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!
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.
any updates on the issue????
@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
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.