(element, props)
| 3838 | } |
| 3839 | |
| 3840 | function updateWrapper(element, props) { |
| 3841 | var node = element; |
| 3842 | { |
| 3843 | var _controlled = isControlled(props); |
| 3844 | |
| 3845 | if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) { |
| 3846 | 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()); |
| 3847 | didWarnUncontrolledToControlled = true; |
| 3848 | } |
| 3849 | if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) { |
| 3850 | 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()); |
| 3851 | didWarnControlledToUncontrolled = true; |
| 3852 | } |
| 3853 | } |
| 3854 | |
| 3855 | updateChecked(element, props); |
| 3856 | |
| 3857 | var value = getSafeValue(props.value); |
| 3858 | |
| 3859 | if (value != null) { |
| 3860 | if (props.type === 'number') { |
| 3861 | if (value === 0 && node.value === '' || |
| 3862 | // eslint-disable-next-line |
| 3863 | node.value != value) { |
| 3864 | node.value = '' + value; |
| 3865 | } |
| 3866 | } else if (node.value !== '' + value) { |
| 3867 | node.value = '' + value; |
| 3868 | } |
| 3869 | } |
| 3870 | |
| 3871 | if (props.hasOwnProperty('value')) { |
| 3872 | setDefaultValue(node, props.type, value); |
| 3873 | } else if (props.hasOwnProperty('defaultValue')) { |
| 3874 | setDefaultValue(node, props.type, getSafeValue(props.defaultValue)); |
| 3875 | } |
| 3876 | |
| 3877 | if (props.checked == null && props.defaultChecked != null) { |
| 3878 | node.defaultChecked = !!props.defaultChecked; |
| 3879 | } |
| 3880 | } |
| 3881 | |
| 3882 | function postMountWrapper(element, props) { |
| 3883 | var node = element; |
no test coverage detected