Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/full-bikes-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@edwardloopez/react-native-coachmark': patch
---

fix(android): avoid invalid SVG path when circle hole has negative dimensions
2 changes: 1 addition & 1 deletion src/ui/Mask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const AnimatedMask: React.FC<{
if (h.shape === 'circle') {
const cx = rect.x + rect.width / 2;
const cy = rect.y + rect.height / 2;
const r = Math.max(rect.width, rect.height) / 2;
const r = Math.abs(Math.max(rect.width, rect.height) / 2);
return `M ${cx} ${cy} m -${r},0 a ${r},${r} 0 1,0 ${r * 2},0 a ${r},${r} 0 1,0 -${r * 2},0`;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ui/shapes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function inset(rect: Rect, pad: number): Rect {
export function pathForCircle(rect: Rect): string {
const cx = rect.x + rect.width / 2;
const cy = rect.y + rect.height / 2;
const r = Math.max(rect.width, rect.height) / 2;
const r = Math.abs(Math.max(rect.width, rect.height) / 2);
return `M ${cx} ${cy} m -${r}, 0 a ${r},${r} 0 1,0 ${r * 2},0 a ${r},${r} 0 1,0 -${r * 2},0`;
}

Expand Down
Loading