npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

carefree-search-amap-react-native

v1.1.1

Published

React Native 高德地图搜索模块,支持 Android/iOS。进行地址和经纬度互转

Readme

carefree-search-amap-react-native

React Native 高德地图搜索模块,支持 Android/iOS。进行地址和经纬度互转

Install

npm install carefree-search-amap-react-native

API

initSDK

设置高德key

import CarefreeSearchAmap from 'carefree-search-amap-react-native';
import { Platform } from "react-native"

const setApiKey =async ()=>{
  try{
    const result = await CarefreeSearchAmap.initSDK(Platform.select({
      ios:'7847002b4f7fa42578df07d8cf9b0e41',
      android: '07976cdaf75c89e7a455f8dd3f3ec56e', 
    }))
    if(result){
      console.log("设置apiKey成功")
    }
  }catch(err){
    console.log(err)
  }
}

getAddress

经纬度===>地址

import CarefreeSearchAmap from 'carefree-search-amap-react-native';

const getAddress =async ()=>{
  try{
    const result = await CarefreeSearchAmap.getAddress({latitude:11.123456,longitude:3.123456})
    if(result&&result.errCode===1000){
      console.log("打印参数--->",result)
    }else{
      console.log(result.errInfo)
    }
  }catch(err){
    console.log(err)
  }
}

getLatLong

地址===>经纬度

import CarefreeSearchAmap from 'carefree-search-amap-react-native';

const getLatLong =async ()=>{
  try{
    const result = await CarefreeSearchAmap.getLatLong("北京天安门广场")
    if(result&&result.errCode===1000){
      console.log("打印参数--->",result)
    }else{
      console.log(result.errInfo)
    }
  }catch(err){
    console.log(err)
  }
}

返回参数说明

|字段|类型|说明| |---|---|---| |errCode|number|错误码| |rCode(android)|number|sdk错误码| |errInfo|string|错误信息| |latitude|number|纬度| |longitude|number|经度| |country|string|国家名称| |postcode|string|国家简码| |province|string|省名称、直辖市的名称| |city|string|城市名称| |cityCode|string|城市编码| |district|string|区(县)名称| |adCode| string|区域编码| |address|string|详细地址| |building|string|建筑物名称| |neighborhood|string|社区名称| |township|string|乡镇名称| |towncode|string|乡镇街道编码| |streetNumber|string|门牌号码| |street|string|门牌信息中的街道名称| |sdkMessage(android)|{rCode:number,errInfo:string}|rCode对应的信息|

错误码(errCode)

|错误码|说明| |-----|----| | -1 | 没有搜索到相关数据 | | -2 | 搜索失败 | | -3 | 查询返回结果进行转换数据的报错信息 | | -4 | 未设置apiKey | | 1000 | 查询成功 |