Annotating points of interest
Annotations are exactly what they sound like; additional information rendered on top of the basic map geography. You get annotations by default when you render MapView
components. 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 the points of interest relevant to your application instead of those rendered by default.
In this section, you'll learn how to render markers for specific locations on the map, as well as rendering regions on the map.
Plotting points
Let's plot some local breweries! Here's how you pass annotations to the MapView
component:
import React from "react"; import { View, StatusBar } from "react-native"; import MapView from "react-native-maps"; import styles from "./styles"; StatusBar.setBarStyle("dark-content"); export default function App() { ...