React-native – Remove the tag from Google Maps

Can the marker be removed from the map view? How to remove markers from Google Maps view. I use “react-native-maps” to display Google Maps.

Please help.

In order to be able to delete or add tags, you only need to perform this operation

//Note: my map markers is => this.props.markers

componentDidMount() {
this.renderMarkers(this.props.markers)
}

< br />async renderMarkers(mapMarkers) {
let markers = [];
markers = mapMarkers.map(marker => ( key={marker.code}
coordinate={{latitude: marker.lat, longitude: marker.lng}}
onPress={{}}
/>)
);
this.setState({markers });
}


refreshMarkers() {
this.renderMarkers(this.props.markers).then(() => {
this.forceUpdate();
});
}


render() {
return (
ref={(ref) => this.mapView = ref}
style={styles.map}
region={this.props.coo rdinate}
>
{this.state.markers}

);
}

< p>Can the marker be deleted from the map view? How to remove markers from Google Maps view. I use “react-native-maps” to display Google Maps.

Please help.

In order to be able to delete or add markers, you only need to perform this operation

//Note: my map markers is => this.props.markers

componentDidMount() {
this.renderMarkers(this.props.markers)
}


async renderMarkers(mapMarkers) {
let markers = [];
markers = mapMarkers.map(marker => ( key={marker.code}
coordinate={{latitude: marker.lat, longitude: marker.lng}}
onPress={{}}
/>)
);
this.setState({markers});
}


refreshMarkers() {
this.renderMarkers(this.props.markers).then(() => {
this.forceUpdate();
}) ;
}


render() {
return (
ref={(ref) => this.mapView = ref}
style={styles.map}
region={this.props.coordinate}
>
{this.state.ma rkers}

);
}

Leave a Comment

Your email address will not be published.