Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
react-native-amap3d
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
放牛的园子
react-native-amap3d
Commits
c6392894
Commit
c6392894
authored
Aug 27, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #42: Android locationEnabled bug
parent
0b9fa6ec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
AMapView.kt
...d/src/main/java/cn/qiuxiang/react/amap3d/maps/AMapView.kt
+11
-5
AMapViewManager.kt
...ain/java/cn/qiuxiang/react/amap3d/maps/AMapViewManager.kt
+2
-1
controls.js
example/src/examples/controls.js
+2
-2
No files found.
android/src/main/java/cn/qiuxiang/react/amap3d/maps/AMapView.kt
View file @
c6392894
...
...
@@ -20,15 +20,16 @@ class AMapView(context: Context) : TextureMapView(context) {
private
val
polylines
=
HashMap
<
String
,
AMapPolyline
>()
private
val
polygons
=
HashMap
<
String
,
AMapPolygon
>()
private
val
circles
=
HashMap
<
String
,
AMapCircle
>()
private
var
locationType
=
MyLocationStyle
.
LOCATION_TYPE_FOLLOW_NO_CENTER
private
val
locationStyle
by
lazy
{
val
locationStyle
=
MyLocationStyle
()
locationStyle
.
myLocationType
(
locationType
)
locationStyle
}
init
{
super
.
onCreate
(
null
)
// 设置默认的定位模式
val
locationStyle
=
MyLocationStyle
()
locationStyle
.
myLocationType
(
MyLocationStyle
.
LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER
)
map
.
myLocationStyle
=
locationStyle
map
.
setOnMapClickListener
{
latLng
->
for
(
marker
in
markers
.
values
)
{
marker
.
active
=
false
...
...
@@ -214,4 +215,9 @@ class AMapView(context: Context) : TextureMapView(context) {
LatLng
(
latitude
+
latitudeDelta
/
2
,
longitude
+
longitudeDelta
/
2
)
))
}
fun
setLocationEnabled
(
enabled
:
Boolean
)
{
map
.
myLocationStyle
=
locationStyle
map
.
isMyLocationEnabled
=
enabled
}
}
android/src/main/java/cn/qiuxiang/react/amap3d/maps/AMapViewManager.kt
View file @
c6392894
...
...
@@ -4,6 +4,7 @@ import android.view.View
import
com.amap.api.maps.AMap
import
com.amap.api.maps.CameraUpdateFactory
import
com.amap.api.maps.model.LatLng
import
com.amap.api.maps.model.MyLocationStyle
import
com.facebook.react.bridge.ReadableArray
import
com.facebook.react.bridge.ReadableMap
import
com.facebook.react.common.MapBuilder
...
...
@@ -69,7 +70,7 @@ internal class AMapViewManager : ViewGroupManager<AMapView>() {
@ReactProp
(
name
=
"locationEnabled"
)
fun
setMyLocationEnabled
(
view
:
AMapView
,
enabled
:
Boolean
)
{
view
.
map
.
isMyLocationEnabled
=
enabled
view
.
setLocationEnabled
(
enabled
)
}
@ReactProp
(
name
=
"showsIndoorMap"
)
...
...
example/src/examples/controls.js
View file @
c6392894
import
React
,
{
Component
}
from
'react'
import
{
StyleSheet
,
View
,
Text
,
Switch
}
from
'react-native'
import
{
StyleSheet
,
Switch
,
Text
,
View
}
from
'react-native'
import
MapView
from
'react-native-amap3d'
import
styles
from
'../styles'
...
...
@@ -48,7 +48,7 @@ export default class Controls extends Component {
<
/View
>
<
/View
>
<
MapView
locationEnabled
=
{
t
rue
}
locationEnabled
=
{
t
his
.
state
.
showsLocationButton
}
showsCompass
=
{
this
.
state
.
showsCompass
}
showsScale
=
{
this
.
state
.
showsScale
}
showsLocationButton
=
{
this
.
state
.
showsLocationButton
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment