Skip to content

Commit 5c6f486

Browse files
authored
Fix map circle transparency (#773)
1 parent ec248ed commit 5c6f486

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/maps/src/components/MapCircle.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ const MapCircle: React.FC<React.PropsWithChildren<MapCircleProps>> = ({
2121
strokeColor = theme.colors.primary,
2222
...rest
2323
}) => {
24-
// Web maps by default uses a lower opacity for the circle, native needs an extra step
25-
const fillColor =
26-
Platform.OS === "web"
27-
? fillColorProp
28-
: Color(fillColorProp).alpha(0.3).rgb().string();
24+
const parsedColor = Color(fillColorProp);
25+
26+
let fillColor;
27+
if (parsedColor.alpha() === 0) {
28+
fillColor = "transparent";
29+
} else if (Platform.OS !== "web") {
30+
// Web maps by default uses a lower opacity for the circle, native needs this extra step
31+
fillColor = parsedColor.alpha(0.3).rgb().string();
32+
} else {
33+
fillColor = fillColorProp;
34+
}
2935

3036
return (
3137
<MapCircleComponent

0 commit comments

Comments
 (0)