react-native-mapbox-gl

mapbox是基於谷歌地圖集成的地圖插件,能夠在不少平臺使用,具體能夠看mapbox官網。這裏具體講解「react-native-mapbox-gl」插件,是mapbox結合react native封裝的地圖插件,能夠很好的實如今頁面上呈現地圖的效果。react

demo地址:https://github.com/mapbox/react-native-mapbox-glandroid

mapbox官網:https://www.mapbox.com/ios

在iOS上運行:git

1.下載demo後解壓,接着進入example文件夾下,根據readme可知,須要添加一個json文件,存放tooken,所以若是沒有mapbox帳戶,須要進入mapbox官網註冊一個,就能夠獲得tooken,接着在根目錄下添加‘env.json文件’,裏面存放tookengithub

2.執行「npm install」命令下載插件npm

3.執行「react-native link」命令,link插件json

4.執行「react-native run-ios」命令,在iOS上運行項目,就能夠看到demo效果了react-native

在android上運行:插件

相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息