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
99d41b03
Commit
99d41b03
authored
Jul 02, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现 iOS animateTo 方法
parent
a6012200
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
5 deletions
+36
-5
MapView.js
components/MapView.js
+15
-5
AMapViewManager.m
ios/AMapViewManager.m
+21
-0
No files found.
components/MapView.js
View file @
99d41b03
...
...
@@ -2,6 +2,8 @@ import React, {PropTypes, Component} from 'react'
import
{
View
,
UIManager
,
NativeModules
,
Platform
,
findNodeHandle
,
requireNativeComponent
,
}
from
'react-native'
...
...
@@ -159,11 +161,19 @@ class MapView extends Component {
}
_sendCommand
(
command
,
params
=
null
)
{
UIManager
.
dispatchViewManagerCommand
(
findNodeHandle
(
this
),
UIManager
.
AMapView
.
Commands
[
command
],
params
,
)
switch
(
Platform
.
OS
)
{
case
'android'
:
UIManager
.
dispatchViewManagerCommand
(
findNodeHandle
(
this
),
UIManager
.
AMapView
.
Commands
[
command
],
params
,
)
break
;
case
'ios'
:
params
[
1
]
=
300
NativeModules
.
AMapViewManager
[
command
](
findNodeHandle
(
this
),
params
)
break
;
}
}
render
()
{
...
...
ios/AMapViewManager.m
View file @
99d41b03
#import <React/RCTViewManager.h>
#import <React/RCTUIManager.h>
#import "AMapView.h"
#import "AMapMarker.h"
#import "AMapModel.h"
...
...
@@ -44,6 +45,26 @@ RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
RCT_EXPORT_VIEW_PROPERTY
(
onLongPress
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onLocation
,
RCTBubblingEventBlock
)
RCT_EXPORT_METHOD
(
animateTo
:
(
nonnull
NSNumber
*
)
reactTag
data
:
(
NSArray
*
)
data
)
{
[
self
.
bridge
.
uiManager
addUIBlock
:
^
(
__unused
RCTUIManager
*
uiManager
,
NSDictionary
<
NSNumber
*
,
UIView
*>
*
viewRegistry
)
{
AMapView
*
mapView
=
(
AMapView
*
)
viewRegistry
[
reactTag
];
NSDictionary
*
params
=
data
[
0
];
CFTimeInterval
duration
=
[
data
[
1
]
doubleValue
]
/
1000
;
if
(
params
[
@"zoomLevel"
])
{
[
mapView
setZoomLevel
:[
params
[
@"zoomLevel"
]
floatValue
]
animated
:
YES
];
}
if
(
params
[
@"coordinate"
])
{
NSDictionary
*
coordinate
=
params
[
@"coordinate"
];
[
mapView
setCenterCoordinate
:
CLLocationCoordinate2DMake
(
[
coordinate
[
@"latitude"
]
doubleValue
],
[
coordinate
[
@"longitude"
]
doubleValue
])
animated
:
YES
];
}
if
(
params
[
@"tilt"
])
{
[
mapView
setCameraDegree
:[
params
[
@"tilt"
]
floatValue
]
animated
:
YES
duration
:
duration
];
}
}];
}
-
(
void
)
mapView
:
(
AMapView
*
)
mapView
didSingleTappedAtCoordinate
:
(
CLLocationCoordinate2D
)
coordinate
{
if
(
mapView
.
onPress
)
{
mapView
.
onPress
(@{
...
...
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