Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onChange = ({
oldIndex,
newIndex,
targetRect,
}: {
oldIndex: number,
newIndex: number,
targetRect: ClientRect,
}) => {
const newItemsState =
newIndex === -1
? arrayRemove(this.state.items, oldIndex)
: arrayMove(this.state.items, oldIndex, newIndex);
this.props.onChange({
newState: newItemsState,
oldIndex,
newIndex,
targetRect,
});
this.internalSetState('change', {items: newItemsState});
};