File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import type MapKitType, {
55 MarkerAnnotationConstructorOptions ,
66 Map ,
77 Annotation ,
8+ FeatureVisibility ,
89} from 'mapkit'
910
1011declare var mapkit: MapKitType
@@ -15,23 +16,25 @@ type Props = MarkerAnnotationConstructorOptions & {
1516 map : Map ,
1617 latitude : number ,
1718 longitude : number ,
18-
19- title ?: string ,
20- subtitle ?: string ,
2119}
2220
2321class Marker extends React . Component < Props > {
2422 marker : Annotation
2523
24+ getMarkerConstructionProps = ( props : Props ) => {
25+ const { map, latitude, longitude, ...otherProps } = props
26+
27+ return otherProps
28+ }
29+
2630 constructor ( props : Props ) {
2731 super ( props )
2832
33+ const markerProps = this . getMarkerConstructionProps ( props )
34+
2935 this . marker = new mapkit . MarkerAnnotation (
3036 new mapkit . Coordinate ( props . latitude , props . longitude ) ,
31- {
32- title : props . title ,
33- subtitle : props . subtitle ,
34- } ,
37+ markerProps ,
3538 )
3639
3740 this . props . map . addAnnotation ( this . marker )
@@ -48,8 +51,11 @@ class Marker extends React.Component<Props> {
4851 )
4952 }
5053
51- this . marker . title = nextProps . title
52- this . marker . subtitle = nextProps . subtitle
54+ const markerProps = this . getMarkerConstructionProps ( nextProps )
55+
56+ Object . keys ( markerProps ) . forEach ( ( key ) => {
57+ this . marker [ key ] = markerProps [ key ]
58+ } )
5359
5460 return false
5561 }
Original file line number Diff line number Diff line change @@ -105,6 +105,9 @@ storiesOf('MapKit', module)
105105 longitude = { number ( 'marker longitude' , - 122.3308333 ) }
106106 title = { text ( 'title' , 'marker title' ) }
107107 subtitle = { text ( 'subtitle' , 'marker subtitle' ) }
108+ glyphText = { text ( 'glyphText' , '' ) }
109+ color = { text ( 'color' , '#ff5b40' ) }
110+ glyphColor = { text ( 'glyphColor' , 'white' ) }
108111 />
109112 </ MapKit >
110113 ) )
You can’t perform that action at this time.
0 commit comments