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
0164651f
Commit
0164651f
authored
Jun 01, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 onInfoWindowClick 接口
parent
7cc24708
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
2 deletions
+13
-2
AMapMarkerManager.java
...main/java/cn/qiuxiang/react/amap3d/AMapMarkerManager.java
+1
-0
AMapView.java
android/src/main/java/cn/qiuxiang/react/amap3d/AMapView.java
+7
-0
Marker.js
components/Marker.js
+1
-0
marker.js
example/src/marker.js
+4
-2
No files found.
android/src/main/java/cn/qiuxiang/react/amap3d/AMapMarkerManager.java
View file @
0164651f
...
...
@@ -27,6 +27,7 @@ class AMapMarkerManager extends SimpleViewManager<AMapMarker> {
map
.
put
(
"onMarkerDragStart"
,
MapBuilder
.
of
(
"registrationName"
,
"onMarkerDragStart"
));
map
.
put
(
"onMarkerDrag"
,
MapBuilder
.
of
(
"registrationName"
,
"onMarkerDrag"
));
map
.
put
(
"onMarkerDragEnd"
,
MapBuilder
.
of
(
"registrationName"
,
"onMarkerDragEnd"
));
map
.
put
(
"onInfoWindowClick"
,
MapBuilder
.
of
(
"registrationName"
,
"onCalloutPress"
));
return
map
;
}
...
...
android/src/main/java/cn/qiuxiang/react/amap3d/AMapView.java
View file @
0164651f
...
...
@@ -102,6 +102,13 @@ public class AMapView extends MapView {
markers
.
get
(
marker
.
getId
()).
sendEvent
(
"onMarkerDragEnd"
,
data
);
}
});
map
.
setOnInfoWindowClickListener
(
new
AMap
.
OnInfoWindowClickListener
()
{
@Override
public
void
onInfoWindowClick
(
Marker
marker
)
{
markers
.
get
(
marker
.
getId
()).
sendEvent
(
"onInfoWindowClick"
,
Arguments
.
createMap
());
}
});
}
public
void
addMarker
(
AMapMarker
marker
)
{
...
...
components/Marker.js
View file @
0164651f
...
...
@@ -60,6 +60,7 @@ class Marker extends Component {
onDragStart
:
React
.
PropTypes
.
func
,
onDrag
:
React
.
PropTypes
.
func
,
onDragEnd
:
React
.
PropTypes
.
func
,
onCalloutPress
:
React
.
PropTypes
.
func
,
}
_eventHandler
(
name
)
{
...
...
example/src/marker.js
View file @
0164651f
import
React
,
{
Component
}
from
'react'
import
{
StyleSheet
}
from
'react-native'
import
{
StyleSheet
,
Alert
}
from
'react-native'
import
{
MapView
,
Marker
}
from
'react-native-amap3d'
export
default
class
MarkerComponent
extends
Component
{
...
...
@@ -13,7 +13,9 @@ export default class MarkerComponent extends Component {
title
=
'一个可拖拽的 Marker'
draggable
selected
onDragEnd
=
{({
nativeEvent
})
=>
console
.
log
(
nativeEvent
)}
onDragEnd
=
{({
nativeEvent
})
=>
Alert
.
alert
(
`新坐标:
${
nativeEvent
.
latitude
}
,
${
nativeEvent
.
longitude
}
`
)}
onCalloutPress
=
{()
=>
Alert
.
alert
(
'Callout Press'
)}
coordinate
=
{{
latitude
:
39.806901
,
longitude
:
116.397972
,
...
...
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