Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove prop-types-extra #1349

Merged
merged 1 commit into from
Jun 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"./dist/react-big-calendar.js": {
"bundled": 561903,
"minified": 171545,
"gzipped": 50435
"bundled": 560715,
"minified": 171082,
"gzipped": 50325
},
"./dist/react-big-calendar.min.js": {
"bundled": 498126,
"minified": 152147,
"gzipped": 45902
"bundled": 496938,
"minified": 151688,
"gzipped": 45761
},
"dist/react-big-calendar.esm.js": {
"bundled": 169800,
"minified": 81627,
"gzipped": 20102,
"bundled": 169709,
"minified": 81558,
"gzipped": 20076,
"treeshaked": {
"rollup": {
"code": 63039,
"import_statements": 1418
"code": 62946,
"import_statements": 1378
},
"webpack": {
"code": 66506
"code": 66385
}
}
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@
"lodash": "^4.17.11",
"memoize-one": "^4.0.3",
"prop-types": "^15.6.2",
"prop-types-extra": "^1.1.0",
"react-overlays": "^1.2.0",
"uncontrollable": "^6.0.0",
"warning": "^4.0.2"
Expand Down
22 changes: 9 additions & 13 deletions src/utils/propTypes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import PropTypes from 'prop-types'
import all from 'prop-types-extra/lib/all'
import { views as Views } from './constants'

let viewNames = Object.keys(Views).map(k => Views[k])
Expand Down Expand Up @@ -27,19 +26,16 @@ export let dateRangeFormat = PropTypes.func
* }}
* ```
*/

export let views = PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.oneOf(viewNames)),
all(PropTypes.object, (props, name, ...args) => {
let prop = props[name],
err

Object.keys(prop).every(key => {
let isBuiltinView =
viewNames.indexOf(key) !== -1 && typeof prop[key] === 'boolean'

return isBuiltinView || !(err = PropTypes.elementType(prop, key, ...args))
})

return err || null
PropTypes.objectOf((prop, key, ...args) => {
let isBuiltinView =
viewNames.indexOf(key) !== -1 && typeof prop[key] === 'boolean'
if (isBuiltinView) {
return null
} else {
return PropTypes.elementType(prop, key, ...args)
}
}),
])