0.13.0 • Published 2 years ago

react-native-wmm-tencentmap v0.13.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

react-native-wmm-tencentmap

腾讯地图选点及定位

Installation

npm install react-native-wmm-tencentmap

Usage

import * as WMMTencentMap from "react-native-wmm-tencentmap";

// ...

// 初始化之前必须先设置隐私合规同意授权WMMTencentMap.setUserAgreePrivacy(true)。app隐私协议必须包含腾讯地图相关隐私协议.未授权会返回RESULT_CODES.PRIVACY_DENY
WMMTencentMap.setUserAgreePrivacy(true)

// 初始化 传入申请好的key值(android需单独配置,参考下面android配置)
WMMTencentMap.init("your_tencentMapSdk_key")

/**
 * 地图选点
 * @param option 反显数据载体,将选点接收到的数据原封传回  {id:"111",title:"xxx",address:"xxx",selectLatLng:{latitudeStr:"30.997859",longitudeStr: "121.004361",xxx:'xxx'}....}
 */
const option = {
  title: '上海市陶行知纪念馆',
  address: '上海市宝山区武威东路76号',
  selectLatLng: {
    latitudeStr: '31.276573',
    longitudeStr: '121.409535'
  },
  xxx1:"xxx1",
  xxx2:"xxx2........",
}
WMMTencentMap.selectAddress(option)

// 定位
WMMTencentMap.location()

// 跳转到权限设置
WMMTencentMap.goToAppDetail()

// 注册监听
WMMTencentMap.addListener(WMMTencentMap.EVENTS.onLocationSuccess,(res)=>{
    if (res){
        // res.code
        // res.result
        // res.message
    }
})
WMMTencentMap.addListener(WMMTencentMap.EVENTS.onLocationFailed,(res)=>{
  if (res){
    // res.code
    // res.result
    // res.message
  }
})

/**
 * RESULT_CODES
 */
export const RESULT_CODES = {
  PERMISSIONS_DENY: 600001, // 用户拒绝授权,需要提示跳转到系统设置页
  PRIVACY_DENY: 600002, // 隐私合规未同意授权
  SELECT_ADDRESS_SUCCESS: 600003, // 地图选择成功
  SELECT_ADDRESS_USER_CANCEL: 600004, // 地图选择用户取消
  LOCATION_SUCCESS: 600005, // 定位成功
  LOCATION_FAIL: 600006, // 定位失败
};

/**
 * 支持的监听事件
 */
export const EVENTS = {
  onLocationSuccess: 'onLocationSuccess',
  onLocationFailed: 'onLocationFailed',
  onSelectAddressSuccess: 'onSelectAddressSuccess',
  onSelectAddressFailed: 'onSelectAddressFailed',
};

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

0.13.0

2 years ago

0.12.1

2 years ago

0.12.0

2 years ago

0.11.3

2 years ago

0.11.2

2 years ago

0.11.1

2 years ago

0.11.0

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.3

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago