Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4c75c5b

Browse files
committed
cherry pick radio input fix
1 parent 571a920 commit 4c75c5b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/renderers/dom/client/wrappers/ReactDOMInput.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var DOMPropertyOperations = require('DOMPropertyOperations');
1313
var LinkedValueUtils = require('LinkedValueUtils');
1414
var ReactDOMComponentTree = require('ReactDOMComponentTree');
1515
var ReactUpdates = require('ReactUpdates');
16-
16+
var inputValueTracking = require('inputValueTracking');
1717
var invariant = require('invariant');
1818
var warning = require('warning');
1919

@@ -348,6 +348,11 @@ function _handleChange(event) {
348348
'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
349349
'same `name` is not supported.',
350350
);
351+
352+
// We need update the tracked value on the named cousin since the value
353+
// was changed but the input saw no event or value set
354+
inputValueTracking.updateValueIfChanged(otherNode);
355+
351356
// If this is a controlled radio button group, forcing the input that
352357
// was previously checked to update will cause it to be come re-checked
353358
// as appropriate.

src/renderers/dom/shared/ReactDOMComponent.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,10 +907,6 @@ ReactDOMComponent.Mixin = {
907907
// happen after `_updateDOMProperties`. Otherwise HTML5 input validations
908908
// raise warnings and prevent the new value from being assigned.
909909
ReactDOMInput.updateWrapper(this);
910-
911-
// We also check that we haven't missed a value update, such as a
912-
// Radio group shifting the checked value to another named radio input.
913-
inputValueTracking.updateValueIfChanged(this);
914910
break;
915911
case 'textarea':
916912
ReactDOMTextarea.updateWrapper(this);

0 commit comments

Comments
 (0)