Created
November 19, 2018 15:47
-
-
Save alejandrosobko/f5357ccbb96537735b3bbf5ac6d3a0af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public onDragEnd(result: any) { | |
const { destination, source, draggableId } = result; | |
if (!destination) { return } | |
const column = this.state.column; | |
const numberIds = Array.from(column.numberIds); | |
numberIds.splice(source.index, 1); | |
numberIds.splice(destination.index, 0, draggableId); | |
const numbers = numberIds.map((numberId: string) => | |
parseInt(this.state.numbers[numberId].content, 10)); | |
this.playSound(numbers); | |
this.updateState(column, numberIds); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment