From 38affa9baebad274bc065d86011dd8e9afa75a74 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Sat, 21 Apr 2018 14:02:25 +0200 Subject: [PATCH] Fix Game2048 on desktop browsers The React Native example only listens for touch events but on web we can listen to mouse events to improve support. Close #909 --- website/storybook/3-demos/Game2048/Game2048.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/website/storybook/3-demos/Game2048/Game2048.js b/website/storybook/3-demos/Game2048/Game2048.js index 50c934b2..ba15c918 100644 --- a/website/storybook/3-demos/Game2048/Game2048.js +++ b/website/storybook/3-demos/Game2048/Game2048.js @@ -184,7 +184,7 @@ class Game2048 extends React.Component { this.setState({ board: new GameBoard() }); }; - _handleTouchStart = (event: Object) => { + _handleStart = (event: Object) => { if (this.state.board.hasWon()) { return; } @@ -193,7 +193,7 @@ class Game2048 extends React.Component { this.startY = event.nativeEvent.pageY; }; - _handleTouchEnd = (event: Object) => { + _handleEnd = (event: Object) => { if (this.state.board.hasWon()) { return; } @@ -220,8 +220,10 @@ class Game2048 extends React.Component { return ( {tiles}