小编典典

如何在React Native的MapView中设置标记

reactjs

  • 我想在React Native的MapView上设置一个标记,但是我无法通过MapView的官方文档找到任何信息。
  • 如果不允许这样做,如何在React Native中使用现有的react模块,例如react-googlemaps

阅读 314

收藏
2020-07-22

共1个答案

小编典典

您可以使用道具设置标记annotations

例如:

var markers = [
  {
    latitude: 45.65,
    longitude: -78.90,
    title: 'Foo Place',
    subtitle: '1234 Foo Drive'
  }
];

<MapView
  region={...}
  annotations={markers}
/>
2020-07-22