Commit f080ae5a authored by Oleksii Savran's avatar Oleksii Savran Committed by Viacheslav Pavlov

Include/Exclude icon does not changes

parent 8eefa17e
...@@ -67,19 +67,26 @@ class StringList extends React.Component<IStringListProps> { ...@@ -67,19 +67,26 @@ class StringList extends React.Component<IStringListProps> {
const {renderList} = this.state; const {renderList} = this.state;
const newRenderList = []; const newRenderList = [];
renderList.map((renderItem) => { renderList.forEach((renderItem) => {
if (doList.indexOf(renderItem.value) !== -1 || notList.indexOf(renderItem.value) !== -1) { const doListIndex = doList.indexOf(renderItem.value);
const notListIndex = notList.indexOf(renderItem.value);
if (doListIndex !== -1 && renderItem.state) {
newRenderList.push(renderItem);
}
if (notListIndex !== -1 && !renderItem.state) {
newRenderList.push(renderItem); newRenderList.push(renderItem);
} }
}); });
doList doList
.filter((doItem) => newRenderList.findIndex((renderItem) => renderItem.value === doItem) === -1) .filter((doItem) => newRenderList.findIndex((renderItem) => renderItem.value === doItem) === -1)
.map((doItem) => newRenderList.push({value: doItem, state: true})); .forEach((doItem) => newRenderList.push({value: doItem, state: true}));
notList notList
.filter((notItem) => newRenderList.findIndex((renderItem) => renderItem.value === notItem) === -1) .filter((notItem) => newRenderList.findIndex((renderItem) => renderItem.value === notItem) === -1)
.map((notItem) => newRenderList.push({value: notItem, state: false})); .forEach((notItem) => newRenderList.push({value: notItem, state: false}));
this.setState({renderList: newRenderList}); this.setState({renderList: newRenderList});
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment