Skip to content

Commit

Permalink
Merge pull request #565 from medmo7/dev-5.x
Browse files Browse the repository at this point in the history
Fix: select item multiple enabled
  • Loading branch information
hossein-zare authored Nov 12, 2022
2 parents d644bef + 3ce3904 commit 82e8173
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ function Picker({

// Not a reliable method for external value changes.
if (multiple) {
if (memoryRef.current.value.includes(item[_schema.value])) {
if (memoryRef.current.value?.includes(item[_schema.value])) {
const index = memoryRef.current.items.findIndex(x => x[_schema.value] === item[_schema.value]);

if (index > -1) {
Expand All @@ -1280,7 +1280,7 @@ function Picker({

setValue(state => {
if (multiple) {
let _state = state !== null ? [...state] : [];
let _state = state !== null && state !== undefined ? [...state] : [];

if (_state.includes(item[_schema.value])) {
// Remove the value
Expand Down

0 comments on commit 82e8173

Please sign in to comment.