MCPcopy Create free account
hub / github.com/Lobos/react-ui / checkSelectPropTypes

Function checkSelectPropTypes

docs/lib/react.js:8224–8244  ·  view source on GitHub ↗

* Validation function for `value` and `defaultValue`. * @private

(inst, props)

Source from the content-addressed store, hash-verified

8222 * @private
8223 */
8224function checkSelectPropTypes(inst, props) {
8225 var owner = inst._currentElement._owner;
8226 LinkedValueUtils.checkPropTypes('select', props, owner);
8227
8228 if (props.valueLink !== undefined && !didWarnValueLink) {
8229 "development" !== 'production' ? warning(false, '`valueLink` prop on `select` is deprecated; set `value` and `onChange` instead.') : void 0;
8230 didWarnValueLink = true;
8231 }
8232
8233 for (var i = 0; i < valuePropNames.length; i++) {
8234 var propName = valuePropNames[i];
8235 if (props[propName] == null) {
8236 continue;
8237 }
8238 if (props.multiple) {
8239 "development" !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
8240 } else {
8241 "development" !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
8242 }
8243 }
8244}
8245
8246/**
8247 * @param {ReactDOMComponent} inst

Callers 1

react.jsFile · 0.85

Calls 2

warningFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…