Dmitriy Bucaev
Dmitriy Bucaev

Reputation: 182

How can I hide tooltip with MapBoxGL.Callout manually in react native (react-native-mapbox-gl)?

I am now showing several markers on the mapview using MapBoxGL.PointAnnotation. I added MapboxGL.Callout component to show tooltip when the marker is selected.

<MapboxGL.PointAnnotation
    key={random.toString()}
    id={random.toString() + '_source'}
    coordinate={tagCoordinates}>
      <Image source={getIconLocal(tagIcon)} />
      <MapboxGL.Callout
        title={`Tag: Pathogen\n${typeName}\nUser: ${userName}\nDate: ${createDate}`}
        style={{minWidth: 200}}
        contentStyle={styles.tagContainer}
        textStyle={styles.tagText}
        tipStyle={styles.tagTip}
      />
</MapboxGL.PointAnnotation>

It's working as I expected. The problem is that I can't hide tooltip when select the rest area of the mapbox. When I select another marker, it's working fine (hide current tooltip and show selected marker's tooltip), but tooltip is remained when select the rest area of the mapview except markers.

Upvotes: 1

Views: 554

Answers (0)

Related Questions