Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onSortEnd = ({oldIndex, newIndex}) => {
if (oldIndex === newIndex) {
return;
}
const {items} = this.state;
this.setState({
items: arrayMove(items, oldIndex, newIndex),
});
// We need to inform React Virtualized that the items have changed heights
// This can either be done by imperatively calling the recomputeRowHeights and
// forceUpdate instance methods on the `List` ref, or by passing an additional prop
// to List that changes whenever the order changes to force it to re-render
this.List.recomputeRowHeights();
this.List.forceUpdate();
};
onSortEnd = ({ oldIndex, newIndex }) => {
const newValue = arrayMove(this.state.friendsData, oldIndex, newIndex)
this.setFriendsList(newValue)
}
onSortEnd = ({ oldIndex, newIndex }: { oldIndex: number; newIndex: number }) => {
const skus = arrayMove(this.props.skus, oldIndex, newIndex);
this.props.onChange(skus);
};
this.setState(({cols}) => ({
cols: arrayMove(cols, oldIndex, newIndex),
}));
};
onSortEnd = ({ oldIndex, newIndex }) => {
const { items } = this.state
this.setState({
items: arrayMove(items, oldIndex, newIndex),
})
}
moveItems({ oldIndex, newIndex }) {
if (oldIndex === newIndex) return;
if (self.sortedhighlightcolor) {
self.regions[oldIndex].setBG(self.sortedhighlightcolor);
}
self.regions[oldIndex].setSelected(true);
if (self._value) self._value = arrayMove(self._value, oldIndex, newIndex);
self.regions = arrayMove(self.regions, oldIndex, newIndex);
self.setUpdate();
},
this.setState(({items}) => ({
items: arrayMove(items, oldIndex, newIndex),
}));
};
const onSortEnd = ({ oldIndex, newIndex, collection }) => {
switch (collection) {
case 'gifs':
setGifs(arrayMove(gifs, oldIndex, newIndex))
break;
case 'newGifs':
setNewGifs(arrayMove(newGifs, oldIndex, newIndex))
break;
default:
break;
}
}