(element, props)
| 4387 | } |
| 4388 | |
| 4389 | function updateWrapper(element, props) { |
| 4390 | var node = element; |
| 4391 | { |
| 4392 | var _controlled = isControlled(props); |
| 4393 | |
| 4394 | if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) { |
| 4395 | warning(false, 'A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components%s', props.type, getCurrentFiberStackAddendum()); |
| 4396 | didWarnUncontrolledToControlled = true; |
| 4397 | } |
| 4398 | if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) { |
| 4399 | warning(false, 'A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components%s', props.type, getCurrentFiberStackAddendum()); |
| 4400 | didWarnControlledToUncontrolled = true; |
| 4401 | } |
| 4402 | } |
| 4403 | |
| 4404 | updateChecked(element, props); |
| 4405 | |
| 4406 | var value = getSafeValue(props.value); |
| 4407 | |
| 4408 | if (value != null) { |
| 4409 | if (props.type === 'number') { |
| 4410 | if (value === 0 && node.value === '' || |
| 4411 | // eslint-disable-next-line |
| 4412 | node.value != value) { |
| 4413 | node.value = '' + value; |
| 4414 | } |
| 4415 | } else if (node.value !== '' + value) { |
| 4416 | node.value = '' + value; |
| 4417 | } |
| 4418 | } |
| 4419 | |
| 4420 | if (props.hasOwnProperty('value')) { |
| 4421 | setDefaultValue(node, props.type, value); |
| 4422 | } else if (props.hasOwnProperty('defaultValue')) { |
| 4423 | setDefaultValue(node, props.type, getSafeValue(props.defaultValue)); |
| 4424 | } |
| 4425 | |
| 4426 | if (props.checked == null && props.defaultChecked != null) { |
| 4427 | node.defaultChecked = !!props.defaultChecked; |
| 4428 | } |
| 4429 | } |
| 4430 | |
| 4431 | function postMountWrapper(element, props) { |
| 4432 | var node = element; |
no test coverage detected