• Stars
    star
    329
  • Rank 127,520 (Top 3 %)
  • Language
    Kotlin
  • License
    MIT License
  • Created over 6 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

React Native BaiduMap SDK for Android + iOS

注意:该项目已暂停维护

react-native-baidumap-sdk npm version build status

React Native BaiduMap SDK for Android + iOS.

你可以下载安装 example.apk 看看实际中的效果。

安装

用法

基本用法

import { MapView } from 'react-native-baidumap-sdk'

render() {
  return <MapView center={{ latitude: 39.2, longitude: 112.4 }} />
}

显示卫星图

<MapView satellite />

监听地图事件

import { MapView } from 'react-native-baidumap-sdk'

render() {
  return (
    <MapView
      onLoad={() => console.log('onLoad')}
      onClick={point => console.log(point)}
      onStatusChange={status => console.log(status)}
    />
  )
}

定位并关联定位图层

import { MapView, Location } from 'react-native-baidumap-sdk'

await Location.init()
Location.addLocationListener(location => this.setState({ location }))
Location.start()

state = { location: null }

render() {
  return <MapView location={this.state.location} locationEnabled />
}

添加标记

<MapView>
  <MapView.Marker
    color="#2ecc71"
    title="This is a marker"
    onPress={this.onPress}
  />
</MapView>

添加自定义图片标记

<MapView>
  <MapView.Marker
    title="This is a image marker"
    image="flag"
    coordinate={{ latitude: 39, longitude: 113 }}
  />
</MapView>

添加自定义 View 标记

<MapView>
  <MapView.Marker
    icon={() => (
      <View>
        <Image source={image} />
        <Text>This is a custom marker</Text>
      </View>
    )}
  />
</MapView>

点聚合

onStatusChange = status => this.cluster.update(status)

renderMarker = item => (
  <MapView.Marker
    key={item.extra.key}
    coordinate={item.coordinate}
  />
)

render() {
  return (
    <MapView onStatusChange={this.onStatusChange}>
      <MapView.Cluster
        ref={ref => this.cluster = ref}
        markers={this.markers}
        renderMarker={this.renderMarker}
      />
    </MapView>
  )
}

显示热力图

points = [
  {
    latitude: 39,
    longitude: 113,
    intensity: 16,
  },
  ...
]

<MapView>
  <MapView.HeatMap
    points={this.points}
    radius={20}
    opacity={0.5}
  />
</MapView>

地理编码/逆地理编码

import { Geocode } from 'react-native-baidumap-sdk'

const searchResult = await Geocode.search('海龙大厦')
const reverseResult = await Geocode.reverse({ latitude: 39, longitude: 113 })

需要注意,以上例子简写了一些属性,并不能直接使用,更多实际的例子请参考:example

接口文档

More Repositories

1

react-native-amap3d

react-native 高德地图组件,使用最新 3D SDK,支持 Android + iOS
TypeScript
1,262
star
2

react-native-amap-geolocation

React Native geolocation module for Android + iOS
TypeScript
383
star
3

tuner

Online tuner based on web audio api
JavaScript
311
star
4

aubiojs

aubio for javascript, the real-time audio processing library
C++
132
star
5

ky-genshin-map

超级丝滑的原神地图,数据来源:空荧酒馆。
TypeScript
130
star
6

react-native-recording

React Native audio recording module used for DSP with Android + iOS
Java
107
star
7

react-native-tuner

A tuner app written in react native, support ios and android.
JavaScript
80
star
8

flutter-android-window

A flutter plugin allows you to create native android floating window.
Kotlin
62
star
9

canvaskit-map

基于 canvaskit,高性能、丝滑的平面地图引擎。
TypeScript
56
star
10

solidity-ls

Solidity language server.
TypeScript
56
star
11

coc-solidity

Solidity language server for coc.nvim
TypeScript
48
star
12

genshin-maps

极致流畅的原神地图 app,支持 android、web、linux、windows、macos
41
star
13

pydoubanfm

Python 实现的豆瓣FM客户端
Python
37
star
14

flutter-fish-completions

fish completions for flutter
Shell
25
star
15

boxbot

百度前端技术学院2016春季班任务:听指令的小方块
JavaScript
22
star
16

gallery

在线相册展示,包括拼图布局、瀑布流、木桶布局
JavaScript
19
star
17

simple_candlestick_chart

A simple candlestick chart for flutter. Supports smooth scroll and zoom.
Dart
19
star
18

pep

Python PEP 中文翻译
13
star
19

doubanfm.sh

Bash douban.fm 客户端
Shell
12
star
20

custom_notched_shape

Flutter BottomAppBar 自定义路径 + 贝塞尔曲线实现闲鱼底部导航类似的效果
Dart
12
star
21

ife2016

百度前端技术学院 2016
HTML
7
star
22

cross_file_image

ImageProvider for XFile
Dart
7
star
23

flutter-tencent-map

flutter 腾讯地图组件(开发中)
Dart
6
star
24

canvas-tilemap

Super smooth 2d tilemap build with canvas2d.
TypeScript
6
star
25

flutter-zhihu

Dart
5
star
26

react-native-rongcloud-imlib

非官方仓库,用于 CI 以及接口文档托管,官方仓库:rongcloud / rongcloud-react-native-imlib
Java
5
star
27

flutter_image_saver

Simple and effective cross platform image saver for flutter, supported web and desktop
Dart
4
star
28

gallery-server

JavaScript
3
star
29

bilibili.sh

Bash 实现的 bilibili 播放器
Python
2
star
30

flutter-finanical-charts-v1

JavaScript
2
star
31

flutter-baidu-map

Dart
2
star
32

flutter-finanical-charts-v2

JavaScript
2
star
33

moyukik

摸鱼 kik 首页实现及优化
Dart
2
star
34

canvas-genshin-maps

超级丝滑的原神地图,基于 canvas2d,全新实现的地图手势识别及渲染,可在手机浏览器下提供接近原生地图的体验。
TypeScript
2
star
35

ethereum-contract-ui

Ethereum contract UI for contract testing without writing any code.
TypeScript
1
star
36

flutter-sound-recording

Flutter sound recording plugin for DSP purposes, now supports android.
Dart
1
star
37

flutter-antd

Dart
1
star
38

flutter_map_demo

Dart
1
star
39

maps

Kotlin
1
star
40

flutter-pay-pwd

Flutter 6 digital payment password input
Dart
1
star
41

wechat

Wechat SDK
PHP
1
star
42

flutter-launcher

应用启动器,为了在超级省电模式下打开其他应用
Dart
1
star
43

indicator-hiwifi

极路由流量监视器
Python
1
star
44

personal-radio

Cloudmusic personal radio player
JavaScript
1
star
45

pycomic

Python 实现的漫画下载工具
Python
1
star