Skip to content

Commit

Permalink
[@mantine/core] Rating: Fix readOnly prop now working on touch devi…
Browse files Browse the repository at this point in the history
…ces (#6202)
  • Loading branch information
rtivital committed May 10, 2024
1 parent 80dcf5d commit 251ff67
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/@mantine/core/src/components/Rating/Rating.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ export const Rating = factory<RatingFactory>((_props, ref) => {
};

const handleTouchStart = (event: React.TouchEvent<HTMLDivElement>) => {
event.preventDefault();

const { touches } = event;
if (touches.length !== 1) {
return;
}

const touch = touches[0];
setValue(getRatingFromCoordinates(touch.clientX));
if (!readOnly) {
const touch = touches[0];
setValue(getRatingFromCoordinates(touch.clientX));
}

onTouchStart?.(event);
};
Expand Down

0 comments on commit 251ff67

Please sign in to comment.