(element, props)
| 4549 | } |
| 4550 | |
| 4551 | function updateWrapper(element, props) { |
| 4552 | var node = element; |
| 4553 | { |
| 4554 | var _controlled = isControlled(props); |
| 4555 | |
| 4556 | if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) { |
| 4557 | 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()); |
| 4558 | didWarnUncontrolledToControlled = true; |
| 4559 | } |
| 4560 | if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) { |
| 4561 | 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()); |
| 4562 | didWarnControlledToUncontrolled = true; |
| 4563 | } |
| 4564 | } |
| 4565 | |
| 4566 | updateChecked(element, props); |
| 4567 | |
| 4568 | var value = getSafeValue(props.value); |
| 4569 | |
| 4570 | if (value != null) { |
| 4571 | if (props.type === 'number') { |
| 4572 | if (value === 0 && node.value === '' || |
| 4573 | // eslint-disable-next-line |
| 4574 | node.value != value) { |
| 4575 | node.value = '' + value; |
| 4576 | } |
| 4577 | } else if (node.value !== '' + value) { |
| 4578 | node.value = '' + value; |
| 4579 | } |
| 4580 | } |
| 4581 | |
| 4582 | if (props.hasOwnProperty('value')) { |
| 4583 | setDefaultValue(node, props.type, value); |
| 4584 | } else if (props.hasOwnProperty('defaultValue')) { |
| 4585 | setDefaultValue(node, props.type, getSafeValue(props.defaultValue)); |
| 4586 | } |
| 4587 | |
| 4588 | if (props.checked == null && props.defaultChecked != null) { |
| 4589 | node.defaultChecked = !!props.defaultChecked; |
| 4590 | } |
| 4591 | } |
| 4592 | |
| 4593 | function postMountWrapper(element, props) { |
| 4594 | var node = element; |
no test coverage detected