From 4daa5ac5cf564dfaaf6f200765210d767ada9d20 Mon Sep 17 00:00:00 2001 From: Amadey Fuerte <57195044+Amadey666@users.noreply.github.com> Date: Mon, 8 Jun 2020 11:14:28 +0300 Subject: [PATCH 1/2] Fix duplicate key error in ListBox.js --- src/components/listbox/ListBox.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/listbox/ListBox.js b/src/components/listbox/ListBox.js index 2528add91a..7625d83ccf 100644 --- a/src/components/listbox/ListBox.js +++ b/src/components/listbox/ListBox.js @@ -278,9 +278,10 @@ export class ListBox extends Component { items = items.map((option, index) => { let optionLabel = this.getOptionLabel(option); + let optionKey = `${optionLabel}_${index}`; return ( - this.onOptionTouchEnd(e, option, index)} tabIndex={this.props.tabIndex} /> ); }); From 2306b049a5541a175b5aa4947a3ab536c6533b36 Mon Sep 17 00:00:00 2001 From: Amadey Fuerte <57195044+Amadey666@users.noreply.github.com> Date: Wed, 10 Jun 2020 12:13:18 +0300 Subject: [PATCH 2/2] Fix Dropdown.js duplicate key error --- src/components/dropdown/Dropdown.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/dropdown/Dropdown.js b/src/components/dropdown/Dropdown.js index 7a40d8be50..4216fb68b7 100644 --- a/src/components/dropdown/Dropdown.js +++ b/src/components/dropdown/Dropdown.js @@ -616,10 +616,12 @@ export class Dropdown extends Component { } if (items) { - return items.map((option) => { + return items.map((option, i) => { let optionLabel = this.getOptionLabel(option); + let optionKey = this.getOptionKey(option, i); + return ( - + ); }); } @@ -649,8 +651,8 @@ export class Dropdown extends Component { return this.props.optionValue ? ObjectUtils.resolveFieldData(option, this.props.optionValue) : (option['value'] !== undefined ? option['value'] : option); } - getOptionKey(option) { - return this.props.dataKey ? ObjectUtils.resolveFieldData(option, this.props.dataKey) : this.getOptionLabel(option); + getOptionKey(option, i) { + return this.props.dataKey ? ObjectUtils.resolveFieldData(option, this.props.dataKey) : `${this.getOptionLabel(option)}-${i}`; } checkValidity() {