(element, props)
| 4514 | } |
| 4515 | |
| 4516 | function updateWrapper(element, props) { |
| 4517 | var node = element; |
| 4518 | { |
| 4519 | var _controlled = isControlled(props); |
| 4520 | |
| 4521 | if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) { |
| 4522 | 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()); |
| 4523 | didWarnUncontrolledToControlled = true; |
| 4524 | } |
| 4525 | if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) { |
| 4526 | 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()); |
| 4527 | didWarnControlledToUncontrolled = true; |
| 4528 | } |
| 4529 | } |
| 4530 | |
| 4531 | updateChecked(element, props); |
| 4532 | |
| 4533 | var value = getSafeValue(props.value); |
| 4534 | |
| 4535 | if (value != null) { |
| 4536 | if (props.type === 'number') { |
| 4537 | if (value === 0 && node.value === '' || |
| 4538 | // eslint-disable-next-line |
| 4539 | node.value != value) { |
| 4540 | node.value = '' + value; |
| 4541 | } |
| 4542 | } else if (node.value !== '' + value) { |
| 4543 | node.value = '' + value; |
| 4544 | } |
| 4545 | } |
| 4546 | |
| 4547 | if (props.hasOwnProperty('value')) { |
| 4548 | setDefaultValue(node, props.type, value); |
| 4549 | } else if (props.hasOwnProperty('defaultValue')) { |
| 4550 | setDefaultValue(node, props.type, getSafeValue(props.defaultValue)); |
| 4551 | } |
| 4552 | |
| 4553 | if (props.checked == null && props.defaultChecked != null) { |
| 4554 | node.defaultChecked = !!props.defaultChecked; |
| 4555 | } |
| 4556 | } |
| 4557 | |
| 4558 | function postMountWrapper(element, props) { |
| 4559 | var node = element; |
no test coverage detected