Skip to content

Commit 51d90fc

Browse files
Moved to prop-types package
1 parent 77dea87 commit 51d90fc

File tree

8 files changed

+57
-51
lines changed

8 files changed

+57
-51
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ The `<InfoWindow />` component included in this library is gives us the ability
212212

213213
![](http://d.pr/i/16w0V.png)
214214

215-
The visibility of the `<InfoWindow />` component is controlled by a `visible` prop. The `visible` prop is a boolean (`React.PropTypes.bool`) that shows the `<InfoWindow />` when true and hides it when false.
215+
The visibility of the `<InfoWindow />` component is controlled by a `visible` prop. The `visible` prop is a boolean (`PropTypes.bool`) that shows the `<InfoWindow />` when true and hides it when false.
216216

217217
```javascript
218218
const WithMarkers = React.createClass({

examples/Container.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {PropTypes as T} from 'react'
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
23
import ReactDOM from 'react-dom'
34
import {Link} from 'react-router'
45
import GitHubForkRibbon from 'react-github-fork-ribbon'
@@ -15,11 +16,11 @@ import styles from './styles.module.css'
1516
export const Container = React.createClass({
1617

1718
propTypes: {
18-
children: T.element.isRequired
19+
children: PropTypes.element.isRequired
1920
},
2021

2122
contextTypes: {
22-
router: T.object
23+
router: PropTypes.object
2324
},
2425

2526
renderChildren: function() {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"npm-font-open-sans": "0.0.3",
5757
"postcss-loader": "^0.9.1",
5858
"precss": "^1.4.0",
59+
"prop-types": "^15.5.8",
5960
"react": "^15.0.0",
6061
"react-addons-test-utils": "^15.0.0",
6162
"react-dom": "^15.0.0",

src/GoogleApiComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {PropTypes as T} from 'react'
1+
import React from 'react'
22
import ReactDOM from 'react-dom'
33

44
import {ScriptCache} from './lib/ScriptCache'

src/components/HeatMap.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { PropTypes as T } from 'react'
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
23

34
import { camelize } from '../lib/String'
45
const evtNames = ['click', 'mouseover', 'recenter'];
@@ -91,12 +92,12 @@ export class HeatMap extends React.Component {
9192
}
9293

9394
HeatMap.propTypes = {
94-
position: T.object,
95-
map: T.object,
96-
icon: T.string
95+
position: PropTypes.object,
96+
map: PropTypes.object,
97+
icon: PropTypes.string
9798
}
9899

99-
evtNames.forEach(e => HeatMap.propTypes[e] = T.func)
100+
evtNames.forEach(e => HeatMap.propTypes[e] = PropTypes.func)
100101

101102
HeatMap.defaultProps = {
102103
name: 'HeatMap'

src/components/InfoWindow.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { PropTypes as T } from 'react'
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
23
import ReactDOM from 'react-dom'
34
import ReactDOMServer from 'react-dom/server'
45

@@ -84,14 +85,14 @@ export class InfoWindow extends React.Component {
8485
}
8586

8687
InfoWindow.propTypes = {
87-
children: T.element.isRequired,
88-
map: T.object,
89-
marker: T.object,
90-
visible: T.bool,
88+
children: PropTypes.element.isRequired,
89+
map: PropTypes.object,
90+
marker: PropTypes.object,
91+
visible: PropTypes.bool,
9192

9293
// callbacks
93-
onClose: T.func,
94-
onOpen: T.func
94+
onClose: PropTypes.func,
95+
onOpen: PropTypes.func
9596
}
9697

9798
InfoWindow.defaultProps = {

src/components/Marker.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { PropTypes as T } from 'react'
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
23

34
import { camelize } from '../lib/String'
45
const evtNames = ['click', 'mouseover', 'recenter', 'dragend'];
@@ -87,11 +88,11 @@ export class Marker extends React.Component {
8788
}
8889

8990
Marker.propTypes = {
90-
position: T.object,
91-
map: T.object
91+
position: PropTypes.object,
92+
map: PropTypes.object
9293
}
9394

94-
evtNames.forEach(e => Marker.propTypes[e] = T.func)
95+
evtNames.forEach(e => Marker.propTypes[e] = PropTypes.func)
9596

9697
Marker.defaultProps = {
9798
name: 'Marker'

src/index.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {PropTypes as T} from 'react';
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
23
import ReactDOM from 'react-dom'
34
import { camelize } from './lib/String'
45
import {makeCancelable} from './lib/cancelablePromise'
@@ -154,7 +155,7 @@ export class Map extends React.Component {
154155

155156
Object.keys(mapConfig).forEach((key) => {
156157
// Allow to configure mapConfig with 'false'
157-
if (mapConfig[key] == null) {
158+
if (mapConfig[key] === null) {
158159
delete mapConfig[key];
159160
}
160161
});
@@ -246,36 +247,36 @@ export class Map extends React.Component {
246247
};
247248

248249
Map.propTypes = {
249-
google: T.object,
250-
zoom: T.number,
251-
centerAroundCurrentLocation: T.bool,
252-
center: T.object,
253-
initialCenter: T.object,
254-
className: T.string,
255-
style: T.object,
256-
containerStyle: T.object,
257-
visible: T.bool,
258-
mapType: T.string,
259-
maxZoom: T.number,
260-
minZoom: T.number,
261-
clickableIcons: T.bool,
262-
disableDefaultUI: T.bool,
263-
zoomControl: T.bool,
264-
mapTypeControl: T.bool,
265-
scaleControl: T.bool,
266-
streetViewControl: T.bool,
267-
panControl: T.bool,
268-
rotateControl: T.bool,
269-
scrollwheel: T.bool,
270-
draggable: T.bool,
271-
keyboardShortcuts: T.bool,
272-
disableDoubleClickZoom: T.bool,
273-
noClear: T.bool,
274-
styles: T.array,
275-
gestureHandling: T.string
250+
google: PropTypes.object,
251+
zoom: PropTypes.number,
252+
centerAroundCurrentLocation: PropTypes.bool,
253+
center: PropTypes.object,
254+
initialCenter: PropTypes.object,
255+
className: PropTypes.string,
256+
style: PropTypes.object,
257+
containerStyle: PropTypes.object,
258+
visible: PropTypes.bool,
259+
mapType: PropTypes.string,
260+
maxZoom: PropTypes.number,
261+
minZoom: PropTypes.number,
262+
clickableIcons: PropTypes.bool,
263+
disableDefaultUI: PropTypes.bool,
264+
zoomControl: PropTypes.bool,
265+
mapTypeControl: PropTypes.bool,
266+
scaleControl: PropTypes.bool,
267+
streetViewControl: PropTypes.bool,
268+
panControl: PropTypes.bool,
269+
rotateControl: PropTypes.bool,
270+
scrollwheel: PropTypes.bool,
271+
draggable: PropTypes.bool,
272+
keyboardShortcuts: PropTypes.bool,
273+
disableDoubleClickZoom: PropTypes.bool,
274+
noClear: PropTypes.bool,
275+
styles: PropTypes.array,
276+
gestureHandling: PropTypes.string
276277
}
277278

278-
evtNames.forEach(e => Map.propTypes[camelize(e)] = T.func)
279+
evtNames.forEach(e => Map.propTypes[camelize(e)] = PropTypes.func)
279280

280281
Map.defaultProps = {
281282
zoom: 14,

0 commit comments

Comments
 (0)