1.1.33 • Published 5 years ago
@parern/pare-native-bmap v1.1.33
@parern/pare-native-bmap百度地图
安装
$ yarn add @parern/pare-native-bmap
API
公共对象方法IOS/Android
- PareBMap.initSDK(String key) \
初始化
//例子: import PareBMap from '@parern/pare-native-bmap'; PareBMap.initSDK(Platform === 'ios' ? 'cV8Zu********3lslTBd' : null);
- PareBMap.nearbySearch(Object) \
附近搜索
PareBMap.nearbySearch({ latitude: '39.982864379882812', longitude: '116.49590301513672', keyWord: '写字楼' }).then(res=>{ console.log(res) });
- PareBMap.citySearch(Object) \
在城市中搜索
PareBMap.citySearch({ city:'上海', keyWord: '写字楼' }).then(res=>{ console.log(res); })
- PareBMap.caculationDistance(Object) \
计算距离
PareBMap.caculationDistance({ latitude: '36.63467788696289', longitude: '115.6556167602539', }).then(res=>{ console.log(res); }).catch(err=>{ console.log(err,'err'); })
- PareBMap.reStartLocation(Object) \
重新定位
PareBMap.reStartLocation().then(res=>{ console.log(res) }).catch(err=>{ console.log(err,'err'); })
- PareBMap.moveToPoint(Object) \
坐标移动
PareBMap.moveToPoint({ address: "保定市雄县", latitude: '38.95136642456055', longitude: '116.26368713378906', name: '马务头林场', })
- PareBMap.addressToLatLng(Object) \
地址转换坐标
PareBMap.addressToLatLng('保定市雄县').then(res=>{ console.log(res); }).catch(err=>{ console.log(err,'err'); })
- PareBMap.latLngToAddress(Object) \
坐标转换地址
PareBMap.latLngToAddress({ latitude: '38.95136642456055', longitude: '116.26368713378906', }).then(res=>{ console.log(res); }).catch(err=>{ console.log(err,'err'); })
基础地图UI组件【IOS/Android】
BaseBMapView
- zoomScale(number) //地图缩放
- mapScrollEnable(bool) //地图是否可拖动
- mapCenterCoordinate(object) //设置地图中心坐标 {latitude:'',longitude:''}
- mapSignCoordinate(object) //设置地图坐标 {latitude:'',longitude:''}
- data(array)
- type(string)
- onChange(function) //地图变化回调
基础地图方法
- BaseBMap
- setZoomScale(number) //地图缩放
- moveToPoint(object) //设置地图坐标 {address:'',latitude:'',longitude:'',name:''}
基础地图事件
- BaseBMapEvent \
监听事件 addListener
testnoti
点击大区标注 data => 大区名 \ 监听事件 addListenerpaopaoNoti
点击弹出窗 data => 标题|||类型|||项目名称 \
个性化地图UI组件【IOS/Android】
- GroupHandProjectBMapView(项目地图)\
GroupHandLandBMapView(土地地图)\
GroupHandLandDetailBMapView(土地详情地图)\
GroupHandLandContrastBMapView(周边土地对比/周边竞品)\
GroupHandCircumBMapView(周边及配套地图)
- zoomScale(number) //地图缩放
- isCluster(bool) 是否为聚合数据(在data前赋值)
- type(number) 0.周边及配套 1.土地地图 2.项目地图 3.周边土地对比 4.土地竞品对比 5.土地详情
- data(array) 大头针数据
- mapZoomEnable(bool) 是否可缩放
- onZoomLevelChange(function) //地图比例尺改变
个性化地图方法【IOS/Android】
- GroupHandProjectBMap(项目地图)\
GroupHandLandBMap(土地地图)\
GroupHandLandDetailBMap(土地详情地图)\
GroupHandLandContrastBMap(周边土地对比/周边竞品)\
GroupHandCircumBMap(周边及配套地图)
- setZoomScale(number) //地图缩放
- backMyLocation() 回到当前位置
- setDistance(double) 设置周边距离
- cancelSelectAnnotation() 取消大头针的选中状态
- moveToPoint(object) //移动到指定位置 {showUserLocation,latitude,longitude} 移动到指定位置
- didSelectedItem(object) //点击列表中的某一项
- mapViewDealloc() //释放地图
项目地图事件
- GroupHandProjectBMapEvent \
监听事件 addListener
clickProjectClusterAnnotation
点击聚合气泡 \ 监听事件 addListenerclickProjectNormalAnnotation
点击普通大头针\
土地地图事件
- GroupHandLandBMapEvent \
监听事件 addListener
clickLandClusterAnnotation
点击聚合气泡 \ 监听事件 addListenerclickLandNormalAnnotation
点击普通大头针\
周边及配套地图事件
- GroupHandCircumBMapEvent \
监听事件 addListener
clickCircumClusterAnnotation
点击聚合气泡 \ 监听事件 addListenerclickCircumNormalAnnotation
点击普通大头针\
配置(Android)
配置AndroidManifest.xml文件,在中加入如下代码配置开发密钥(AK)
<application>
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="开发者 key" />
</application>
例子
import React from 'react';
import {Button} from 'react-native';
import PareBMap, {BaseBMapView,BaseBMapEvent} from '@parern/pare-native-bmap';
class BmapComponent extends React.Component {
constructor(props) {
super(props);
}
state = {
zoom: 10,
};
componentDidMount() {
console.log(PareBMap);
BaseBMapEvent.addListener('testnoti', data => {
console.log(data);
});
BaseBMapEvent.addListener('paopaoNoti', data => {
console.log(data);
});
}
setZoom = () => {
console.log(PareBMap);
this.setState({
zoom: Math.ceil(Math.random() * 21),
});
};
render() {
return (
<>
<BaseBMapView zoomScale={this.state.zoom} style={{flex: 1}} />
<Button
onPress={this.setZoom}
style={{position: 'absolute'}}
title={'点击'}
/>
</>
);
}
}
export default BmapComponent;
1.1.33
5 years ago
1.1.32
5 years ago
1.1.30
5 years ago
1.1.31
5 years ago
1.1.29
5 years ago
1.1.28
5 years ago
1.1.27
5 years ago
1.1.26
5 years ago
1.1.25
5 years ago
1.1.24
5 years ago
1.1.23
5 years ago
1.1.22
5 years ago
1.1.21
5 years ago
1.1.20
5 years ago
1.1.19
5 years ago
1.1.18
5 years ago
1.1.17
5 years ago
1.1.16
5 years ago
1.1.15
5 years ago
1.1.14
5 years ago
1.1.13
5 years ago
1.1.12
5 years ago
1.1.11
5 years ago
1.1.10
5 years ago
1.1.9
5 years ago
1.1.8
5 years ago
1.1.7
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.4
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago