Unable to select multiple values
See original GitHub issueim having problems when I want to select multiple items. When I select one option they throw me this error: TypeError: Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a Symbol.iterator method.
Anyone know how to solved this problem??
im using the version: “react-native-dropdown-picker”: “^5.1.21” here is what im doing:
export default class Example extends React.Component {
constructor(props) {
super(props);
this.state = {
openCurrencyDropDown: false,
data: [
{ label: 'Op1', value: "Op1" },
{ label: 'Op2', value: "Op2" },
{ label: 'Op3', value: "Op3" },
{ label: 'Op4', value: "Op4" },
{ label: 'Op5', value: "Op5" },
{ label: 'Op6', value: "Op6" },
],
value: [],
}
this.setValue = this.setValue.bind(this);
}
setValue(callback) {
this.setState(state => ({
value: callback(state.value)
}));
}
render() {
<DropDownPicker
listMode={'MODAL'}
multiple={true}
min={0}
max={5}
open={this.state.openCurrencyDropDown}
setOpen={this.setOpenCurrencyDropDown}
setValue={this.setValue}
items={this.state.data}
defaultValue={this.state.value}
/>
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (6 by maintainers)
Top Results From Across the Web
Unable to select multiple options for a multi-select picklist
1. Use an alternative browser · 2. Switch to salesforce classic · 3. Click out of the picklist frame and then select the...
Read more >Unable to multiple select items in combo box
A strange problem here. I have a combo box (comboBooks) that writes the selected choice to a single line text column in a...
Read more >2939246 - Unable to Select Multiple Values in Report
Go to Business Analytics · Go to Design Report and search for the effected report · Click on the value help of the...
Read more >Cannot select multiple values when running a report ... - IBM
To resolve the issue, please follow these steps: Open Cognos admin console. ... Click on drop down next to "System" and select "Set...
Read more >PowerBI Service - Cannot select multiple items in slicer
Solved: For whatever reason, cannot select multiple items in slicer, regardless whether you use Shift + Click or you use Single Select ->...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@kjoonas1 Note that your state variable (value) must be an array
[]Follow the official example: https://hossein-zare.github.io/react-native-dropdown-picker-website/docs/usage/#multiple-items
@kjoonas1 Interesting!
setValue’s callback always gets the current value, Thevaluevariable isn’tundefinedwhile thevalueparam in the callback isundefined.The
valuedoesn’t change until you press an item, There’s something wrong on your side i believe.I encourage you to try firing the
setValuein auseEffect:Don’t forget to restart your app after the changes.