Socket
Socket
Sign inDemoInstall

react-native-open-map-navigation

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-open-map-navigation

打开App自带的地图导航


Version published
Weekly downloads
6
Maintainers
1
Created
Weekly downloads
 

Readme

Source

react-native-open-map-navigation

地图导航,打开手机自带的地图导航App,打开iOS系统自带的地图

如下图

image

Table of contents

  • Install
  • Usage

Install

1: yarn add 或者npm install

yarn add react-native-open-map-navigation

2: iOS需要配置url scheme白名单,iOS工程Info.plist添加如下配置

<key>LSApplicationQueriesSchemes</key>
<array>
	<string>baidumap</string>
	<string>iosamap</string>
	<string>comgooglemaps</string>
	<string>qqmap</string>
</array>

Usage

NOTE: 可以参考Example的App.js中的方法

import OpenMapNavigation from 'react-native-open-map-navigation'

// 经纬度,actionSheet 选择,不用去管UI
OpenMapNavigation.openMapActionSheet("121.467237", "31.234532", "上海华盛大公馆", {
              onFail: (e) => {
                console.log(e)
              },
              onNoMapApp: () => {
                console.log("没有相关地图")
              },
              onSelectItem: (item) => {
                console.log("选择了:%o", item)
              }
            })
// 只返回当前支持跳转的地图app url和title,  需要自行写UI列表
OpenMapNavigation.getMapRouterApp("121.467237", "31.234532", "上海华盛大公馆")
// getMapRouterApp 返回的item,打开地图
OpenMapNavigation.openMapRouter(mapItem)
// 检查是否安装了某个app
OpenMapNavigation.appAndroidPackageInstalled("安卓的包名com.test.main")
// 打开iOS自带的地图方法
OpenMapNavigation.openMapIOS("121.467237", "31.234532", "上海华盛大公馆")

Keywords

FAQs

Last updated on 11 Aug 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc