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
aeeca19f
Commit
aeeca19f
authored
Jul 13, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现 iOS onStatusChange 事件接口
parent
e0ce0319
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
AMapView.h
ios/AMapView.h
+3
-0
AMapViewManager.m
ios/AMapViewManager.m
+24
-0
No files found.
ios/AMapView.h
View file @
aeeca19f
...
@@ -6,5 +6,7 @@
...
@@ -6,5 +6,7 @@
@property
(
nonatomic
,
copy
)
RCTBubblingEventBlock
onLocation
;
@property
(
nonatomic
,
copy
)
RCTBubblingEventBlock
onLocation
;
@property
(
nonatomic
,
copy
)
RCTBubblingEventBlock
onPress
;
@property
(
nonatomic
,
copy
)
RCTBubblingEventBlock
onPress
;
@property
(
nonatomic
,
copy
)
RCTBubblingEventBlock
onLongPress
;
@property
(
nonatomic
,
copy
)
RCTBubblingEventBlock
onLongPress
;
@property
(
nonatomic
,
copy
)
RCTBubblingEventBlock
onStatusChange
;
@property
(
nonatomic
,
copy
)
RCTBubblingEventBlock
onStatusChangeComplete
;
@end
@end
\ No newline at end of file
ios/AMapViewManager.m
View file @
aeeca19f
...
@@ -48,6 +48,8 @@ RCT_EXPORT_VIEW_PROPERTY(rotation, CGFloat)
...
@@ -48,6 +48,8 @@ RCT_EXPORT_VIEW_PROPERTY(rotation, CGFloat)
RCT_EXPORT_VIEW_PROPERTY
(
onPress
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onPress
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onLongPress
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onLongPress
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onLocation
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onLocation
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onStatusChange
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onStatusChangeComplete
,
RCTBubblingEventBlock
)
RCT_EXPORT_METHOD
(
animateTo
:
(
nonnull
NSNumber
*
)
reactTag
params
:
(
NSDictionary
*
)
params
duration
:
(
NSInteger
)
duration
)
{
RCT_EXPORT_METHOD
(
animateTo
:
(
nonnull
NSNumber
*
)
reactTag
params
:
(
NSDictionary
*
)
params
duration
:
(
NSInteger
)
duration
)
{
[
self
.
bridge
.
uiManager
addUIBlock
:
^
(
__unused
RCTUIManager
*
uiManager
,
NSDictionary
<
NSNumber
*
,
UIView
*>
*
viewRegistry
)
{
[
self
.
bridge
.
uiManager
addUIBlock
:
^
(
__unused
RCTUIManager
*
uiManager
,
NSDictionary
<
NSNumber
*
,
UIView
*>
*
viewRegistry
)
{
...
@@ -157,4 +159,26 @@ RCT_EXPORT_METHOD(animateTo:(nonnull NSNumber *)reactTag params:(NSDictionary *)
...
@@ -157,4 +159,26 @@ RCT_EXPORT_METHOD(animateTo:(nonnull NSNumber *)reactTag params:(NSDictionary *)
}
}
}
}
-
(
NSDictionary
*
)
buildStatusData
:
(
MAMapStatus
*
)
status
{
return
@{
@"zoomLevel"
:
@
(
status
.
zoomLevel
),
@"tilt"
:
@
(
status
.
cameraDegree
),
@"rotation"
:
@
(
status
.
rotationDegree
),
@"latitude"
:
@
(
status
.
centerCoordinate
.
latitude
),
@"longitude"
:
@
(
status
.
centerCoordinate
.
longitude
),
};
}
-
(
void
)
mapViewRegionChanged
:
(
AMapView
*
)
mapView
{
if
(
mapView
.
onStatusChange
)
{
mapView
.
onStatusChange
([
self
buildStatusData
:
mapView
.
getMapStatus
]);
}
}
-
(
void
)
mapView
:
(
AMapView
*
)
mapView
regionDidChangeAnimated
:
(
BOOL
)
animated
{
if
(
mapView
.
onStatusChangeComplete
)
{
mapView
.
onStatusChangeComplete
([
self
buildStatusData
:
mapView
.
getMapStatus
]);
}
}
@end
@end
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