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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@td-design/react-native-amap-search

v2.0.1

Published

search

Downloads

8

Readme

react-native-amap-search

search

安装

npm or yarn

npm install @td-design/react-native-amap-search

yarn add @td-design/react-native-amap-search

# ios 项目需要更新 pods
cd ios
pod install

使用

添加高德 Key

  • ios

1 获取高德 key

2 在 AppDelegate.m 里引入 SDK 头文件 #import <AMapFoundationKit/AMapFoundationKit.h>, 并设置高德 Key [AMapServices sharedServices].apiKey = @"你的高德 Key";。

  • android

1 获取高德 key

2 编辑 Android 项目的 AndroidManifest.xml(一般在 android\app\src\main\AndroidManifest.xml),添加如下代码:

<application>
  <meta-data android:name="com.amap.api.v2.apikey" android:value="你的高德 Key" />
</application>

用法

1 初始化

import { init } from '@td-design/react-native-amap-search';

init();

2 调用

import { useAMapSearch } from '@td-design/react-native-amap-search';

const { aMapPOIKeywordsSearch, data } = useAMapSearch();

API

1 aMapPOIKeywordsSearch(关键字搜索)

export interface KeyWordsSearchPOIParams {
  /**关键字 */
  keywords?: string;
  /**范围 */
  cityLimit?: boolean;
  /**是否指定城市 */
  city?: string;
  /**是否人工干预 */
  special?: boolean;
  /**页数 */
  page?: number;
  /**一页的数量 */
  pageSize?: number;
  /**文本分类、分类代码 */
  types?: string;
}

2 aMapPOIAroundSearch(周边 poi 搜索)

export interface SearchPOIParams {
  /**纬度 */
  latitude: number;
  /**经度 */
  longitude: number; // 经度
  /** 关键字*/
  keywords?: string;
  /**范围 */
  radius?: number;
  /** 是否指定城市*/
  city?: string;
  /** 是否人工干预*/
  special?: boolean;
  /**页数 */
  page?: number;
  /**一页的数量 */
  pageSize?: number;
  /**文本分类、分类代码 */
  types?: string;
}

3 aMapPOIPolygonSearch(区域 poi 搜索)

export interface PolygonSearchParams {
  /** 多边形的点*/
  points: AMapGeoPoint[];
  /**关键字 */
  keywords: string;
  /**页数 */
  page?: number;
  /**一页的数量 */
  pageSize?: number;
  /**文本分类、分类代码 */
  types?: string;
}

4 RouteSearchParams(道路规划沿途的 poi)

export interface RouteSearchParams {
  /**开始位置 */
  origin: AMapGeoPoint;
  /** 结束位置*/
  destination: AMapGeoPoint;
  /** 驾车导航策略*/
  strategy?: number;
  /**搜索类型 */
  searchType?: number;
  /**道路周围搜索范围,单位米,[0-500],默认250。 */
  range?: number;
}

返回

export interface ResultPOI {
  /**POI全局唯一ID */
  uid: string;
  /**名称 */
  name: string;
  /**兴趣点类型 */
  type: string;
  /**类型编码 */
  typecode: string;
  /** 纬度*/
  latitude: number;
  /**经度 */
  longitude: number;
  /**地址 */
  address: string;
  /**电话 */
  tel: string;
  /**距中心点的距离,单位米 */
  distance: number;
  /**停车场类型,地上、地下 */
  parkingType: string;
  /**商铺id */
  shopID: string;
  /**邮编 */
  postcode: string;
  /**网址 */
  website: string;
  /** 电子邮件*/
  email: string;
  /**省 */
  province: string;
  /**省编码 */
  pcode: string;
  /** 市*/
  city: string;
  /**城市编码 */
  citycode: string;
  /** 区域名称*/
  district: string;
  /**区域编码 */
  adcode: string;
}