mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Use the same value synchronization function on number blur (#11746)
I updated ReactDOMInput.synchronizeDefaultValue such that it assignes the defaultValue property instead of the value attribute. I never followed up on the ChangeEventPlugin's on blur behavior.
This commit is contained in:
committed by
Dan Abramov
parent
31ea0aa6d7
commit
8ce53671ed
@@ -307,7 +307,7 @@ function updateNamedCousins(rootNode, props) {
|
||||
// when the user is inputting text
|
||||
//
|
||||
// https://github.com/facebook/react/issues/7253
|
||||
function synchronizeDefaultValue(
|
||||
export function synchronizeDefaultValue(
|
||||
node: InputWithWrapperState,
|
||||
type: ?string,
|
||||
value: *,
|
||||
|
||||
@@ -17,6 +17,7 @@ import getEventTarget from './getEventTarget';
|
||||
import isEventSupported from './isEventSupported';
|
||||
import {getNodeFromInstance} from '../client/ReactDOMComponentTree';
|
||||
import * as inputValueTracking from '../client/inputValueTracking';
|
||||
import {synchronizeDefaultValue} from '../client/ReactDOMFiberInput';
|
||||
|
||||
var eventTypes = {
|
||||
change: {
|
||||
@@ -235,10 +236,7 @@ function handleControlledInputBlur(inst, node) {
|
||||
}
|
||||
|
||||
// If controlled, assign the value attribute to the current value on blur
|
||||
let value = '' + node.value;
|
||||
if (node.getAttribute('value') !== value) {
|
||||
node.setAttribute('value', value);
|
||||
}
|
||||
synchronizeDefaultValue(node, 'number', node.value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user