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
6201ae3d
Commit
6201ae3d
authored
Aug 18, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码以及完善注释文档
parent
6a4fcea4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
46 deletions
+106
-46
Circle.js
components/Circle.js
+24
-6
MapView.js
components/MapView.js
+24
-14
Marker.js
components/Marker.js
+2
-9
Overlay.js
components/Overlay.js
+4
-6
Polygon.js
components/Polygon.js
+27
-5
Polyline.js
components/Polyline.js
+25
-6
No files found.
components/Circle.js
View file @
6201ae3d
import
React
,
{
PropTypes
,
Component
}
from
'react'
import
{
requireNativeComponent
,
View
,
PixelRatio
,
Platform
}
from
'react-native'
import
{
requireNativeComponent
,
ViewPropTypes
,
PixelRatio
,
Platform
,
}
from
'react-native'
import
{
LatLng
}
from
'./PropTypes'
class
Circle
extends
Component
{
export
default
class
Circle
extends
Component
{
static
propTypes
=
{
...
View
.
p
ropTypes
,
...
View
P
ropTypes
,
/**
* 圆点
...
...
@@ -16,9 +21,24 @@ class Circle extends Component {
*/
radius
:
PropTypes
.
number
.
isRequired
,
/**
* 边线宽度
*/
strokeWidth
:
PropTypes
.
number
,
/**
* 边线颜色
*/
strokeColor
:
PropTypes
.
string
,
/**
* 填充颜色
*/
fillColor
:
PropTypes
.
string
,
/**
* 层级
*/
zIndex
:
PropTypes
.
number
,
}
...
...
@@ -35,6 +55,4 @@ class Circle extends Component {
}
}
AMapCircle
=
requireNativeComponent
(
'AMapCircle'
,
Circle
)
export
default
Circle
const
AMapCircle
=
requireNativeComponent
(
'AMapCircle'
,
Circle
)
components/MapView.js
View file @
6201ae3d
import
React
,
{
PropTypes
,
Component
}
from
'react'
// @flow
import
React
,
{
Component
,
PropTypes
}
from
'react'
import
{
View
,
UIManager
,
findNodeHandle
,
requireNativeComponent
,
UIManager
,
ViewPropTypes
,
}
from
'react-native'
import
{
LatLng
,
Region
}
from
'./PropTypes'
type
Target
=
{
zoomLevel
?:
number
,
coordinate
?:
LatLng
,
titl
?:
number
,
rotation
?:
number
,
}
export
default
class
MapView
extends
Component
{
static
propTypes
=
{
...
View
.
p
ropTypes
,
...
View
P
ropTypes
,
/**
* 地图类型
...
...
@@ -57,7 +65,7 @@ export default class MapView extends Component {
/**
* 是否显示放大缩小按钮
*
*
Android only
*
@platform android
*/
showsZoomControls
:
PropTypes
.
bool
,
...
...
@@ -69,7 +77,7 @@ export default class MapView extends Component {
/**
* 是否显示定位按钮
*
*
Android only
*
@platform android
*/
showsLocationButton
:
PropTypes
.
bool
,
...
...
@@ -154,7 +162,7 @@ export default class MapView extends Component {
onAnimateCancel
:
React
.
PropTypes
.
func
,
/**
* 地图状态变化
(包括移动、缩放、倾斜、旋转)
事件
* 地图状态变化事件
*/
onStatusChange
:
React
.
PropTypes
.
func
,
...
...
@@ -165,16 +173,18 @@ export default class MapView extends Component {
}
/**
* 动画过渡到某个位置(坐标、缩放级别、倾斜度)
*
* @param {{zoomLevel: ?number, coordinate: ?LatLng, titl: ?number}} target
* @param duration
* 动画过渡到某个状态(坐标、缩放级别、倾斜度、旋转角度)
*/
animateTo
(
target
,
duration
=
500
)
{
animateTo
(
target
:
Target
,
duration
?:
number
=
500
)
{
this
.
_sendCommand
(
'animateTo'
,
[
target
,
duration
])
}
_sendCommand
(
command
,
params
=
null
)
{
/**
* call native method
*
* @private
*/
_sendCommand
(
command
:
string
,
params
?:
[])
{
UIManager
.
dispatchViewManagerCommand
(
findNodeHandle
(
this
),
UIManager
.
AMapView
.
Commands
[
command
],
...
...
@@ -187,4 +197,4 @@ export default class MapView extends Component {
}
}
AMapView
=
requireNativeComponent
(
'AMapView'
,
MapView
)
const
AMapView
=
requireNativeComponent
(
'AMapView'
,
MapView
)
components/Marker.js
View file @
6201ae3d
import
React
,
{
PropTypes
,
Pure
Component
}
from
'react'
import
React
,
{
PropTypes
,
Component
}
from
'react'
import
{
requireNativeComponent
,
View
,
...
...
@@ -9,7 +9,7 @@ import {
import
{
LatLng
}
from
'./PropTypes'
import
Overlay
from
'./Overlay'
export
default
class
Marker
extends
Pure
Component
{
export
default
class
Marker
extends
Component
{
static
propTypes
=
{
...
ViewPropTypes
,
...
...
@@ -30,13 +30,6 @@ export default class Marker extends PureComponent {
/**
* 自定义图标
*
* 可以是回调函数返回的自定义 View,需要注意的是,
* Root View 必须是 Overlay,且需设置 style width。
*
* 内置的颜色有限,如需真正的自定义颜色,
* 建议使用自定义 View 引用 Image,如此,
* 任何颜色都可以通过 tintColor 进行设置。
*/
icon
:
PropTypes
.
oneOfType
([
Platform
.
select
({
...
...
components/Overlay.js
View file @
6201ae3d
import
React
,
{
PropTypes
,
Component
}
from
'react'
import
{
View
,
View
PropTypes
,
UIManager
,
findNodeHandle
,
requireNativeComponent
,
}
from
'react-native'
class
Overlay
extends
Component
{
export
default
class
Overlay
extends
Component
{
static
propTypes
=
{
...
View
.
p
ropTypes
,
...
View
P
ropTypes
,
}
_update
()
{
...
...
@@ -29,6 +29,4 @@ class Overlay extends Component {
}
}
AMapOverlay
=
requireNativeComponent
(
'AMapOverlay'
,
Overlay
)
export
default
Overlay
const
AMapOverlay
=
requireNativeComponent
(
'AMapOverlay'
,
Overlay
)
components/Polygon.js
View file @
6201ae3d
import
React
,
{
PropTypes
,
Component
}
from
'react'
import
{
requireNativeComponent
,
View
,
PixelRatio
,
Platform
}
from
'react-native'
import
{
requireNativeComponent
,
ViewPropTypes
,
PixelRatio
,
Platform
,
}
from
'react-native'
import
{
LatLng
}
from
'./PropTypes'
class
Polygon
extends
Component
{
export
default
class
Polygon
extends
Component
{
static
propTypes
=
{
...
View
.
p
ropTypes
,
...
View
P
ropTypes
,
/**
* 节点
*/
coordinates
:
PropTypes
.
arrayOf
(
LatLng
).
isRequired
,
/**
* 边线宽度
*/
strokeWidth
:
PropTypes
.
number
,
/**
* 边线颜色
*/
strokeColor
:
PropTypes
.
string
,
/**
* 填充颜色
*/
fillColor
:
PropTypes
.
string
,
/**
* 层级
*/
zIndex
:
PropTypes
.
number
,
}
...
...
@@ -27,5 +51,3 @@ class Polygon extends Component {
}
AMapPolygon
=
requireNativeComponent
(
'AMapPolygon'
,
Polygon
)
export
default
Polygon
components/Polyline.js
View file @
6201ae3d
import
React
,
{
PropTypes
,
Component
}
from
'react'
import
{
processColor
,
requireNativeComponent
,
View
,
PixelRatio
,
Platform
}
from
'react-native'
import
{
processColor
,
requireNativeComponent
,
ViewPropTypes
,
PixelRatio
,
Platform
,
}
from
'react-native'
import
{
LatLng
}
from
'./PropTypes'
class
Polyline
extends
Component
{
export
default
class
Polyline
extends
Component
{
static
propTypes
=
{
...
View
.
p
ropTypes
,
...
View
P
ropTypes
,
/**
* 节点
*/
coordinates
:
PropTypes
.
arrayOf
(
LatLng
).
isRequired
,
/**
* 线段宽度
*/
width
:
PropTypes
.
number
,
/**
* 线段颜色
*/
color
:
PropTypes
.
string
,
/**
* 层级
*/
zIndex
:
PropTypes
.
number
,
/**
...
...
@@ -67,6 +88,4 @@ class Polyline extends Component {
}
}
AMapPolyline
=
requireNativeComponent
(
'AMapPolyline'
,
Polyline
)
export
default
Polyline
const
AMapPolyline
=
requireNativeComponent
(
'AMapPolyline'
,
Polyline
)
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