Commit 19142683 authored by Qiu Xiang's avatar Qiu Xiang

添加 MapView#locationInterval 接口

相关:#37、#41
parent b7eba783
...@@ -220,4 +220,9 @@ class AMapView(context: Context) : TextureMapView(context) { ...@@ -220,4 +220,9 @@ class AMapView(context: Context) : TextureMapView(context) {
map.myLocationStyle = locationStyle map.myLocationStyle = locationStyle
map.isMyLocationEnabled = enabled map.isMyLocationEnabled = enabled
} }
fun setLocationInterval(interval: Long) {
locationStyle.interval(interval)
map.myLocationStyle = locationStyle
}
} }
...@@ -185,4 +185,9 @@ internal class AMapViewManager : ViewGroupManager<AMapView>() { ...@@ -185,4 +185,9 @@ internal class AMapViewManager : ViewGroupManager<AMapView>() {
fun changeRotation(view: AMapView, rotation: Float) { fun changeRotation(view: AMapView, rotation: Float) {
view.map.moveCamera(CameraUpdateFactory.changeBearing(rotation)) view.map.moveCamera(CameraUpdateFactory.changeBearing(rotation))
} }
@ReactProp(name = "locationInterval")
fun setLocationInterval(view: AMapView, interval: Int) {
view.setLocationInterval(interval.toLong())
}
} }
...@@ -31,6 +31,13 @@ export default class MapView extends BaseComponent { ...@@ -31,6 +31,13 @@ export default class MapView extends BaseComponent {
*/ */
locationEnabled: PropTypes.bool, locationEnabled: PropTypes.bool,
/**
* 定位间隔(ms),默认 2000,小于 1000 将只进行单次定位
*
* @platform android
*/
locationInterval: PropTypes.number,
/** /**
* 是否显示室内地图 * 是否显示室内地图
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment