MCPcopy Create free account
hub / github.com/Lucifier129/react-lite / checkSelectPropTypes

Function checkSelectPropTypes

examples/simple/react.js:7762–7777  ·  view source on GitHub ↗

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

(inst, props)

Source from the content-addressed store, hash-verified

7760 * @private
7761 */
7762function checkSelectPropTypes(inst, props) {
7763 var owner = inst._currentElement._owner;
7764 LinkedValueUtils.checkPropTypes('select', props, owner);
7765
7766 for (var i = 0; i < valuePropNames.length; i++) {
7767 var propName = valuePropNames[i];
7768 if (props[propName] == null) {
7769 continue;
7770 }
7771 if (props.multiple) {
7772 "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)) : undefined;
7773 } else {
7774 "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)) : undefined;
7775 }
7776 }
7777}
7778
7779/**
7780 * @param {ReactDOMComponent} inst

Callers 1

react.jsFile · 0.85

Calls 2

warningFunction · 0.50

Tested by

no test coverage detected