This repository was archived by the owner on Aug 23, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ const propTypes = {
61
61
] ) . isRequired ,
62
62
modelValue : PropTypes . any ,
63
63
viewValue : PropTypes . any ,
64
+ defaultValue : PropTypes . any ,
64
65
control : PropTypes . any ,
65
66
onLoad : PropTypes . func ,
66
67
onSubmit : PropTypes . func ,
@@ -463,6 +464,8 @@ function createControlClass(s = defaultStrategy) {
463
464
defaultValue = controlProps . defaultValue ;
464
465
} else if ( controlProps . hasOwnProperty ( 'defaultChecked' ) ) {
465
466
defaultValue = controlProps . defaultChecked ;
467
+ } else if ( this . props . hasOwnProperty ( 'defaultValue' ) ) {
468
+ defaultValue = this . props . defaultValue ;
466
469
}
467
470
468
471
const loadActions = [ this . getValidateAction ( defaultValue ) ] ;
Original file line number Diff line number Diff line change @@ -32,9 +32,12 @@ const standardPropsMap = {
32
32
33
33
const textPropsMap = {
34
34
...standardPropsMap ,
35
- value : ( props ) => ( ( ! props . defaultValue && ! props . hasOwnProperty ( 'value' ) )
36
- ? getTextValue ( props . viewValue )
37
- : props . value ) ,
35
+ // the value passed into the control is either the original control's
36
+ // value prop (if the control is controlled) or the value controlled by
37
+ // <Control>.
38
+ value : ( props ) => ( props . hasOwnProperty ( 'value' )
39
+ ? props . value
40
+ : getTextValue ( props . viewValue ) ) ,
38
41
} ;
39
42
40
43
const getModelValue = ( { modelValue } ) => modelValue ;
You can’t perform that action at this time.
0 commit comments