Skip to content

Commit 2a2206c

Browse files
committed
MapMarkerShadowFilter
1 parent c12ba83 commit 2a2206c

5 files changed

Lines changed: 60 additions & 76 deletions

File tree

src/components/MapView/Icons/MapCurrentLocation.tsx

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {useId} from 'react';
2-
import {Defs, FeDropShadow, Filter, G, Path, Svg} from 'react-native-svg';
2+
import {G, Path, Svg} from 'react-native-svg';
33
import type {SvgProps} from 'react-native-svg';
4+
import MapMarkerShadowFilter from './MapMarkerShadowFilter';
45

56
function MapCurrentLocation({width = 48, height = 48}: SvgProps) {
67
const filterId = useId();
@@ -11,24 +12,11 @@ function MapCurrentLocation({width = 48, height = 48}: SvgProps) {
1112
viewBox="0 0 48 48"
1213
fill="none"
1314
>
14-
<Defs>
15-
<Filter
16-
id={filterId}
17-
x="0"
18-
y="0"
19-
width="48"
20-
height="48"
21-
filterUnits="userSpaceOnUse"
22-
>
23-
<FeDropShadow
24-
dx={0}
25-
dy={4}
26-
stdDeviation={6}
27-
floodColor="#021204"
28-
floodOpacity={0.06}
29-
/>
30-
</Filter>
31-
</Defs>
15+
<MapMarkerShadowFilter
16+
id={filterId}
17+
width="48"
18+
height="48"
19+
/>
3220
<G filter={`url(#${filterId})`}>
3321
<Path
3422
fill="#0185ff"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import {Defs, FeDropShadow, Filter} from 'react-native-svg';
2+
3+
type MapMarkerShadowFilterProps = {
4+
id: string;
5+
width: string;
6+
height: string;
7+
};
8+
9+
function MapMarkerShadowFilter({id, width, height}: MapMarkerShadowFilterProps) {
10+
return (
11+
<Defs>
12+
<Filter
13+
id={id}
14+
x="0"
15+
y="0"
16+
width={width}
17+
height={height}
18+
filterUnits="userSpaceOnUse"
19+
>
20+
<FeDropShadow
21+
dx={0}
22+
dy={4}
23+
stdDeviation={6}
24+
floodColor="#021204"
25+
floodOpacity={0.06}
26+
/>
27+
</Filter>
28+
</Defs>
29+
);
30+
}
31+
32+
export default MapMarkerShadowFilter;

src/components/MapView/Icons/MapStartWaypoint.tsx

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {useId} from 'react';
2-
import {Defs, FeDropShadow, Filter, G, Path, Svg} from 'react-native-svg';
2+
import {G, Path, Svg} from 'react-native-svg';
33
import type {SvgProps} from 'react-native-svg';
4+
import MapMarkerShadowFilter from './MapMarkerShadowFilter';
45

56
function MapStartWaypoint({width = 48, height = 48}: SvgProps) {
67
const filterId = useId();
@@ -11,24 +12,11 @@ function MapStartWaypoint({width = 48, height = 48}: SvgProps) {
1112
viewBox="0 0 48 48"
1213
fill="none"
1314
>
14-
<Defs>
15-
<Filter
16-
id={filterId}
17-
x="0"
18-
y="0"
19-
width="48"
20-
height="48"
21-
filterUnits="userSpaceOnUse"
22-
>
23-
<FeDropShadow
24-
dx={0}
25-
dy={4}
26-
stdDeviation={6}
27-
floodColor="#021204"
28-
floodOpacity={0.06}
29-
/>
30-
</Filter>
31-
</Defs>
15+
<MapMarkerShadowFilter
16+
id={filterId}
17+
width="48"
18+
height="48"
19+
/>
3220
<G filter={`url(#${filterId})`}>
3321
<Path
3422
fill="#085239"

src/components/MapView/Icons/MapStopWaypoint.tsx

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {useId} from 'react';
2-
import {Defs, FeDropShadow, Filter, G, Path, Svg} from 'react-native-svg';
2+
import {G, Path, Svg} from 'react-native-svg';
33
import type {SvgProps} from 'react-native-svg';
4+
import MapMarkerShadowFilter from './MapMarkerShadowFilter';
45

56
function MapStopWaypoint({width = 48, height = 53}: SvgProps) {
67
const filterId = useId();
@@ -11,24 +12,11 @@ function MapStopWaypoint({width = 48, height = 53}: SvgProps) {
1112
viewBox="0 0 48 53"
1213
fill="none"
1314
>
14-
<Defs>
15-
<Filter
16-
id={filterId}
17-
x="0"
18-
y="0"
19-
width="48"
20-
height="52.695"
21-
filterUnits="userSpaceOnUse"
22-
>
23-
<FeDropShadow
24-
dx={0}
25-
dy={4}
26-
stdDeviation={6}
27-
floodColor="#021204"
28-
floodOpacity={0.06}
29-
/>
30-
</Filter>
31-
</Defs>
15+
<MapMarkerShadowFilter
16+
id={filterId}
17+
width="48"
18+
height="52.695"
19+
/>
3220
<G filter={`url(#${filterId})`}>
3321
<Path
3422
fill="#085239"

src/components/MapView/Icons/MapWaypoint.tsx

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {useId} from 'react';
2-
import {Circle, Defs, FeDropShadow, Filter, Svg} from 'react-native-svg';
2+
import {Circle, Svg} from 'react-native-svg';
33
import type {SvgProps} from 'react-native-svg';
4+
import MapMarkerShadowFilter from './MapMarkerShadowFilter';
45

56
function MapWaypoint({width = 40, height = 40}: SvgProps) {
67
const filterId = useId();
@@ -11,24 +12,11 @@ function MapWaypoint({width = 40, height = 40}: SvgProps) {
1112
viewBox="0 0 40 40"
1213
fill="none"
1314
>
14-
<Defs>
15-
<Filter
16-
id={filterId}
17-
x="0"
18-
y="0"
19-
width="40"
20-
height="40"
21-
filterUnits="userSpaceOnUse"
22-
>
23-
<FeDropShadow
24-
dx={0}
25-
dy={4}
26-
stdDeviation={6}
27-
floodColor="#021204"
28-
floodOpacity={0.06}
29-
/>
30-
</Filter>
31-
</Defs>
15+
<MapMarkerShadowFilter
16+
id={filterId}
17+
width="40"
18+
height="40"
19+
/>
3220
<Circle
3321
cx="20"
3422
cy="16"

0 commit comments

Comments
 (0)