@@ -119,7 +119,7 @@ async function fetchImageIOS(imagePath: string): Promise<any> {
119119 if ( ! imagePath ) return null ;
120120 if ( _markerIconDownloadCache [ imagePath ] ) return _markerIconDownloadCache [ imagePath ] ;
121121 const img = await Http . getImage ( imagePath ) ;
122- if ( img && img . ios ) {
122+ if ( img ? .ios ) {
123123 _markerIconDownloadCache [ imagePath ] = img . ios ;
124124 return img . ios ;
125125 }
@@ -474,7 +474,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
474474 this . setMapboxViewInstance ( nativeMap ) ;
475475
476476 if ( settings . showUserLocation ) {
477- this . showUserLocationMarker ( { } ) ;
477+ this . showUserLocationMarker ( { cameraMode : 'NONE' } ) ;
478478 }
479479
480480 this . initEventHandlerShim ( settings , this . _mapboxViewInstance ) ;
@@ -632,7 +632,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
632632 ) ;
633633
634634 updated . forEach ( ( m ) => {
635- if ( m . icon && typeof m . icon === 'string' && ( m as any ) . iconDownloaded ) {
635+ if ( typeof m ? .icon === 'string' && ( m as any ) . iconDownloaded ) {
636636 try {
637637 b . addImage ( m . icon , ( m as any ) . iconDownloaded ) ;
638638 delete ( m as any ) . iconDownloaded ;
@@ -669,8 +669,8 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
669669 _marker . lng = newSettings . lng ;
670670 b . updateMarkerPosition ( _marker . id + '' , newSettings . lat , newSettings . lng ) ;
671671 }
672-
673- if ( newSettings . selected ) {
672+ if ( newSettings . selected || this . isMarkerSelected ( _marker ) ) {
673+ // this will also update callout position
674674 this . selectMarker ( _marker ) ;
675675 }
676676 }
@@ -688,8 +688,12 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
688688 } ) ;
689689 }
690690 selectedMarker : MapboxMarker ;
691+
692+ isMarkerSelected ( marker : MapboxMarker ) {
693+ return this . selectedMarker === marker || this . selectedMarker ?. id === marker . id ;
694+ }
691695 async deselectMarker ( marker : MapboxMarker ) {
692- if ( this . selectedMarker === marker || this . selectedMarker ?. id === marker . id ) {
696+ if ( this . isMarkerSelected ( marker ) ) {
693697 this . hideCalloutForMarkerById ( marker . id + '' ) ;
694698 this . selectedMarker = null ;
695699 }
@@ -700,7 +704,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
700704 if ( Trace . isEnabled ( ) ) {
701705 CLog ( CLogTypes . info , 'selectMarker():' , marker . id ) ;
702706 }
703- if ( this . selectedMarker ) {
707+ if ( this . selectedMarker && ! this . isMarkerSelected ( marker ) ) {
704708 this . deselectMarker ( this . selectedMarker ) ;
705709 }
706710 await this . showCalloutForMarkerById ( marker . id + '' ) ;
@@ -1371,8 +1375,6 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
13711375 if ( Trace . isEnabled ( ) ) {
13721376 CLog ( CLogTypes . info , 'createCalloutView1():' , marker . id , marker . title , ! ! this . _reusableCalloutView ) ;
13731377 }
1374- this . _reusableCalloutView . removeEventListener ( 'tap' ) ;
1375- ( this . _reusableCalloutView . nativeViewProtected as UIView ) ?. removeFromSuperview ( ) ;
13761378 return this . _reusableCalloutView ;
13771379 }
13781380
@@ -1384,10 +1386,12 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
13841386 if ( Trace . isEnabled ( ) ) {
13851387 CLog ( CLogTypes . info , 'showCalloutForMarkerById():' , typeof markerId , markerId ) ;
13861388 }
1389+ const callout = this . createCalloutView ( m ) ;
13871390 if ( this . bridgeInstance . hasViewAnnotationForMarker ( markerId ) ) {
1388- return ;
1391+ // let s Update
1392+ this . bridgeInstance . removeViewAnnotationForMarker ( markerId ) ;
1393+ // return;
13891394 }
1390- const callout = this . createCalloutView ( m ) ;
13911395 callout . on ( 'tap' , ( ) => {
13921396 try {
13931397 const res = m . onCalloutTap ? m . onCalloutTap ( m ) : undefined ;
@@ -1396,6 +1400,8 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
13961400 console . error ( 'callout tap handler error' , e ) ;
13971401 }
13981402 } ) ;
1403+ this . _reusableCalloutView . removeEventListener ( 'tap' ) ;
1404+ ( this . _reusableCalloutView . nativeViewProtected as UIView ) ?. removeFromSuperview ( ) ;
13991405 try {
14001406 const nativeView = createUIViewAutoSizeUIViewAutoSize ( callout ) ;
14011407 if ( Trace . isEnabled ( ) ) {
@@ -1778,12 +1784,12 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
17781784 onStart ( nativeMap ?: any ) : Promise < void > {
17791785 return Promise . resolve ( ) ;
17801786 }
1781- onResume ( nativeMap ?: any ) : Promise < void > {
1782- return Promise . resolve ( ) ;
1783- }
1784- onPause ( nativeMap ?: any ) : Promise < void > {
1785- return Promise . resolve ( ) ;
1786- }
1787+ // onResume(nativeMap?: any): Promise<void> {
1788+ // return Promise.resolve();
1789+ // }
1790+ // onPause(nativeMap?: any): Promise<void> {
1791+ // return Promise.resolve();
1792+ // }
17871793 onStop ( nativeMap ?: any ) : Promise < void > {
17881794 return Promise . resolve ( ) ;
17891795 }
0 commit comments