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

react-native-baidu-map-wabg

v0.1.7

Published

"基于react-native-baidu-map添加了一些自定义属性或方法"

Downloads

19

Readme

react-native-baidu-map-wabg

基于【react-native-baidu-map】添加了一些自定义属性或方法,这里主要说下我修改的东西,详情参考原文

  • IOS和Android修改的东西基本一样,本示例只做参考,请根据代码自行调整
  • Geolocation中添加了detailSearch suggestSearch nearbySearch 方法

detailSearch 详情搜索

  • <uid> 百度地图返回的uid
detailSearch(uid){
    return new Promise((resolve, reject) => {
      try {
        _module.detailSearch(uid);
      }
      catch (e) {
        reject(e);
      }
      DeviceEventEmitter.once('onGetDetailSearchResult', resp => {
        resolve(resp);
      });
    });
  }

suggestSearch 建议搜索

  • <keyword> 搜索关键字
  • <cityname> 搜索城市名称
suggestSearch(keyword, cityname){
    if (Platform.OS == 'ios') {
      return new Promise((resolve, reject) => {
        try {
          _module.suggestSearch(keyword,cityname);
        }
        catch (e) {
          reject(e);
          return;
        }
        NativeAppEventEmitter.once('onGetSuggestionResult',(resp) => {
          resolve(resp)
        })
      },(error) => {
        reject(error);
      });
    }
    return new Promise((resolve, reject) => {
      try {
        _module.suggestSearch(keyword, cityname);
      }
      catch (e) {
        reject(e);
      }
      DeviceEventEmitter.once('OnGetSuggestionResult', resp => {
        resolve(resp);
      });
    });
  }

JS示例:

Geolocation.suggestSearch(keyword,city)
.then(res => {
  if(res&&res.code === 0){
    this.setState({list:res.data})
  }else{
    res.message && Alert.alert(res.message);
  }
})
.catch(e =>{
    
})

nearbySearch 周边搜索

  • <lat> 纬度
  • <lng> 经度
  • <ak> 服务端AK
  • <geoTableId> lbs云表id
  • <filter> 过滤字段
nearbySearch(lat, lng, ak, geoTableId, filter){
    if (Platform.OS == 'ios') {
      return new Promise((resolve, reject) => {
        try {
          _module.nearbySearch(lat + '', lng  + '', ak, geoTableId, filter);
        }
        catch (e) {
          reject(e);
          return;
        }
        NativeAppEventEmitter.once('onCloudSearch',(resp) => {
          resolve(resp)
        })
      },(error) => {
        reject(error);
      });
    }
    return new Promise((resolve, reject) => {
      try {
        _module.nearbySearch(lat, lng ,ak, geoTableId, filter);
      }
      catch (e) {
        reject(e);
        return;
      }
      DeviceEventEmitter.once('onCloudSearchResult', resp => {
        resolve(resp);
      });
    });
  }

JS调用示例:

Geolocation.nearbySearch(latitude ,longitude,Your_Server_AK, Your_GeoTableId,0)
.then(res => {
  console.log('nearbySearchMarkers',res);
  if(res&&res.code === 0){
    this.setState({
      markers:res.data || []
    })
  }else{
    console.log(res.message)
  }
})
.catch(e =>{
  console.warn(e, 'error');
})