Annotating points of interest
So far, you've seen how the MapView
component can render the user's current location and points of interest around the user. The challenge here is that you probably want to show points of interest that are relevant to your application, instead of the points of interest that are rendered by default.
In this section, you'll learn how to render markers for specific locations on the map, as well as render regions on the map.
Plotting points
Let's plot some local breweries, shall we? Here's how you pass annotations to the MapView
component:
import React from 'react'; import { AppRegistry, View, } from 'react-native'; import MapView from 'react-native-maps'; import styles from './styles'; const PlottingPoints = () => ( <View style={styles.container}> <MapView style={styles.mapView} showsPointsOfInterest={false} showsUserLocation followUserLocation...