(element, props)
| 3747 | } |
| 3748 | |
| 3749 | function updateWrapper(element, props) { |
| 3750 | var node = element; |
| 3751 | { |
| 3752 | var _controlled = isControlled(props); |
| 3753 | |
| 3754 | if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) { |
| 3755 | 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()); |
| 3756 | didWarnUncontrolledToControlled = true; |
| 3757 | } |
| 3758 | if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) { |
| 3759 | 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()); |
| 3760 | didWarnControlledToUncontrolled = true; |
| 3761 | } |
| 3762 | } |
| 3763 | |
| 3764 | updateChecked(element, props); |
| 3765 | |
| 3766 | var value = getSafeValue(props.value); |
| 3767 | |
| 3768 | if (value != null) { |
| 3769 | if (props.type === 'number') { |
| 3770 | if (value === 0 && node.value === '' || |
| 3771 | // eslint-disable-next-line |
| 3772 | node.value != value) { |
| 3773 | node.value = '' + value; |
| 3774 | } |
| 3775 | } else if (node.value !== '' + value) { |
| 3776 | node.value = '' + value; |
| 3777 | } |
| 3778 | } |
| 3779 | |
| 3780 | if (props.hasOwnProperty('value')) { |
| 3781 | setDefaultValue(node, props.type, value); |
| 3782 | } else if (props.hasOwnProperty('defaultValue')) { |
| 3783 | setDefaultValue(node, props.type, getSafeValue(props.defaultValue)); |
| 3784 | } |
| 3785 | |
| 3786 | if (props.checked == null && props.defaultChecked != null) { |
| 3787 | node.defaultChecked = !!props.defaultChecked; |
| 3788 | } |
| 3789 | } |
| 3790 | |
| 3791 | function postMountWrapper(element, props) { |
| 3792 | var node = element; |
no test coverage detected