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> {
const {renderList} = this.state;
const newRenderList = [];
renderList.map((renderItem) => {
if (doList.indexOf(renderItem.value) !== -1 || notList.indexOf(renderItem.value) !== -1) {
renderList.forEach((renderItem) => {
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);
}
});
doList
.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
.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});
}
......
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