Skip to content

Commit

Permalink
fix: catch empty touches in TouchableRipple on web (#2029)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaulz committed Jun 30, 2020
1 parent 85c3240 commit 704e66b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/TouchableRipple/index.tsx
Expand Up @@ -119,12 +119,10 @@ class TouchableRipple extends React.Component<Props> {
touchX = dimensions.width / 2;
touchY = dimensions.height / 2;
} else {
const startX = e.nativeEvent.touches
? e.nativeEvent.touches[0].pageX
: e.pageX;
const startY = e.nativeEvent.touches
? e.nativeEvent.touches[0].pageY
: e.pageY;
const { changedTouches, touches } = e.nativeEvent;
const touch = touches?.[0] ?? changedTouches?.[0];
const startX = touch.pageX ?? e.pageX;
const startY = touch.pageY ?? e.pageY;

touchX = startX - dimensions.left;
touchY = startY - dimensions.top;
Expand Down

0 comments on commit 704e66b

Please sign in to comment.