Skip to content

Commit a943b95

Browse files
committed
Bugfix and add example with the polyline
1 parent fcd880c commit a943b95

File tree

4 files changed

+47
-7
lines changed

4 files changed

+47
-7
lines changed

dist/components/Polyline.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,19 @@
157157
var _props = this.props,
158158
map = _props.map,
159159
google = _props.google,
160-
paths = _props.paths,
160+
path = _props.path,
161161
strokeColor = _props.strokeColor,
162162
strokeOpacity = _props.strokeOpacity,
163163
strokeWeight = _props.strokeWeight,
164-
props = _objectWithoutProperties(_props, ['map', 'google', 'paths', 'strokeColor', 'strokeOpacity', 'strokeWeight']);
164+
props = _objectWithoutProperties(_props, ['map', 'google', 'path', 'strokeColor', 'strokeOpacity', 'strokeWeight']);
165165

166166
if (!google) {
167167
return null;
168168
}
169169

170170
var params = _extends({
171171
map: map,
172-
paths: paths,
172+
path: path,
173173
strokeColor: strokeColor,
174174
strokeOpacity: strokeOpacity,
175175
strokeWeight: strokeWeight
@@ -211,7 +211,7 @@
211211
}(_react2.default.Component);
212212

213213
Polyline.propTypes = {
214-
paths: _propTypes2.default.array,
214+
path: _propTypes2.default.array,
215215
strokeColor: _propTypes2.default.string,
216216
strokeOpacity: _propTypes2.default.number,
217217
strokeWeight: _propTypes2.default.number

examples/components/withPolylines.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
3+
4+
import Map, {GoogleApiWrapper} from '../../src/index'
5+
import Polyline from '../../src/components/Polyline'
6+
7+
const WithPolylines = React.createClass({
8+
render: function() {
9+
if (!this.props.loaded) {
10+
return <div>Loading...</div>
11+
}
12+
13+
const polyline = [
14+
{ lat: 37.789411, lng: -122.422116 },
15+
{ lat: 37.785757, lng: -122.421333 },
16+
{ lat: 37.789352, lng: -122.415346 }
17+
]
18+
19+
return (
20+
<Map google={this.props.google}
21+
style={{width: '100%', height: '100%', position: 'relative'}}
22+
className={'map'}
23+
zoom={14}>
24+
<Polyline
25+
path={polyline}
26+
strokeColor="#0000FF"
27+
strokeOpacity={0.8}
28+
strokeWeight={2}
29+
fillColor="#0000FF"
30+
fillOpacity={0.35} />
31+
</Map>
32+
)
33+
}
34+
});
35+
36+
export default WithPolylines

examples/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ const routeMap = {
3434
'polygons': {
3535
name: 'Polygon',
3636
component: require('./components/withPolygons').default
37+
},
38+
'polyline': {
39+
name: 'Polyline',
40+
component: require('./components/withPolylines').default
3741
}
3842
}
3943

src/components/Polyline.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class Polyline extends React.Component {
4242
const {
4343
map,
4444
google,
45-
paths,
45+
path,
4646
strokeColor,
4747
strokeOpacity,
4848
strokeWeight,
@@ -55,7 +55,7 @@ export class Polyline extends React.Component {
5555

5656
const params = {
5757
map,
58-
paths,
58+
path,
5959
strokeColor,
6060
strokeOpacity,
6161
strokeWeight,
@@ -90,7 +90,7 @@ export class Polyline extends React.Component {
9090
}
9191

9292
Polyline.propTypes = {
93-
paths: PropTypes.array,
93+
path: PropTypes.array,
9494
strokeColor: PropTypes.string,
9595
strokeOpacity: PropTypes.number,
9696
strokeWeight: PropTypes.number

0 commit comments

Comments
 (0)