(element, props)
| 4652 | } |
| 4653 | |
| 4654 | function updateWrapper(element, props) { |
| 4655 | var node = element; |
| 4656 | { |
| 4657 | var _controlled = isControlled(props); |
| 4658 | |
| 4659 | if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) { |
| 4660 | 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()); |
| 4661 | didWarnUncontrolledToControlled = true; |
| 4662 | } |
| 4663 | if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) { |
| 4664 | 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()); |
| 4665 | didWarnControlledToUncontrolled = true; |
| 4666 | } |
| 4667 | } |
| 4668 | |
| 4669 | updateChecked(element, props); |
| 4670 | |
| 4671 | var value = getSafeValue(props.value); |
| 4672 | |
| 4673 | if (value != null) { |
| 4674 | if (props.type === 'number') { |
| 4675 | if (value === 0 && node.value === '' || |
| 4676 | // eslint-disable-next-line |
| 4677 | node.value != value) { |
| 4678 | node.value = '' + value; |
| 4679 | } |
| 4680 | } else if (node.value !== '' + value) { |
| 4681 | node.value = '' + value; |
| 4682 | } |
| 4683 | } |
| 4684 | |
| 4685 | if (props.hasOwnProperty('value')) { |
| 4686 | setDefaultValue(node, props.type, value); |
| 4687 | } else if (props.hasOwnProperty('defaultValue')) { |
| 4688 | setDefaultValue(node, props.type, getSafeValue(props.defaultValue)); |
| 4689 | } |
| 4690 | |
| 4691 | if (props.checked == null && props.defaultChecked != null) { |
| 4692 | node.defaultChecked = !!props.defaultChecked; |
| 4693 | } |
| 4694 | } |
| 4695 | |
| 4696 | function postMountWrapper(element, props) { |
| 4697 | var node = element; |
no test coverage detected