Commit fe76f486 authored by sen's avatar sen

添加LocationType only Android

parent 5e411d6a
...@@ -227,4 +227,8 @@ class AMapView(context: Context) : TextureMapView(context) { ...@@ -227,4 +227,8 @@ class AMapView(context: Context) : TextureMapView(context) {
locationStyle.myLocationIcon(BitmapDescriptorFactory.fromResource(drawable)) locationStyle.myLocationIcon(BitmapDescriptorFactory.fromResource(drawable))
} }
} }
fun setLocationType(type: Int) {
locationStyle.myLocationType(type)
}
} }
...@@ -194,4 +194,18 @@ internal class AMapViewManager : ViewGroupManager<AMapView>() { ...@@ -194,4 +194,18 @@ internal class AMapViewManager : ViewGroupManager<AMapView>() {
fun setLocationStyle(view: AMapView, style: ReadableMap) { fun setLocationStyle(view: AMapView, style: ReadableMap) {
view.setLocationStyle(style) view.setLocationStyle(style)
} }
@ReactProp(name = "locationType")
fun setLocationStyle(view: AMapView, type: String) {
when (type) {
"show" -> view.setLocationType(MyLocationStyle.LOCATION_TYPE_SHOW)
"locate" -> view.setLocationType(MyLocationStyle.LOCATION_TYPE_LOCATE)
"follow" -> view.setLocationType(MyLocationStyle.LOCATION_TYPE_FOLLOW)
"map_rotate" -> view.setLocationType(MyLocationStyle.LOCATION_TYPE_MAP_ROTATE)
"location_rotate" -> view.setLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE)
"location_rotate_no_center" -> view.setLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER)
"follow_no_center" -> view.setLocationType(MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER)
"map_rotate_no_center" -> view.setLocationType(MyLocationStyle.LOCATION_TYPE_MAP_ROTATE_NO_CENTER)
}
}
} }
...@@ -39,6 +39,14 @@ export default class MapView extends Component<any> { ...@@ -39,6 +39,14 @@ export default class MapView extends Component<any> {
*/ */
locationStyle: LocationStyle, locationStyle: LocationStyle,
/**
* 设置定位模式 默认 LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER
*
* @platform android
*/
locationType: PropTypes.oneOf(['show', 'locate', 'follow', 'map_rotate', 'location_rotate',
'location_rotate_no_center', 'follow_no_center', 'map_rotate_no_center']),
/** /**
* 是否启用定位 * 是否启用定位
*/ */
......
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