(element, props)
| 4607 | } |
| 4608 | |
| 4609 | function updateWrapper(element, props) { |
| 4610 | var node = element; |
| 4611 | { |
| 4612 | var _controlled = isControlled(props); |
| 4613 | |
| 4614 | if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) { |
| 4615 | 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()); |
| 4616 | didWarnUncontrolledToControlled = true; |
| 4617 | } |
| 4618 | if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) { |
| 4619 | 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()); |
| 4620 | didWarnControlledToUncontrolled = true; |
| 4621 | } |
| 4622 | } |
| 4623 | |
| 4624 | updateChecked(element, props); |
| 4625 | |
| 4626 | var value = getSafeValue(props.value); |
| 4627 | |
| 4628 | if (value != null) { |
| 4629 | if (props.type === 'number') { |
| 4630 | if (value === 0 && node.value === '' || |
| 4631 | // eslint-disable-next-line |
| 4632 | node.value != value) { |
| 4633 | node.value = '' + value; |
| 4634 | } |
| 4635 | } else if (node.value !== '' + value) { |
| 4636 | node.value = '' + value; |
| 4637 | } |
| 4638 | } |
| 4639 | |
| 4640 | if (props.hasOwnProperty('value')) { |
| 4641 | setDefaultValue(node, props.type, value); |
| 4642 | } else if (props.hasOwnProperty('defaultValue')) { |
| 4643 | setDefaultValue(node, props.type, getSafeValue(props.defaultValue)); |
| 4644 | } |
| 4645 | |
| 4646 | if (props.checked == null && props.defaultChecked != null) { |
| 4647 | node.defaultChecked = !!props.defaultChecked; |
| 4648 | } |
| 4649 | } |
| 4650 | |
| 4651 | function postMountWrapper(element, props) { |
| 4652 | var node = element; |
no test coverage detected