File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export interface ReactCodeInputProps {
2121 placeholder ?: string
2222
2323 // Value of the input
24- value ?: string
24+ value ?: string | null
2525
2626 // Get the full value of the input on every change
2727 onChange ?: ( value : string ) => void
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ class ReactCodeInput extends Component {
3333 super ( props ) ;
3434
3535 const { fields, forceUppercase } = props ;
36- let { value } = props ;
36+ let value = props . value || '' ;
3737
3838 if ( forceUppercase ) {
3939 value = value . toUpperCase ( ) ;
@@ -55,6 +55,10 @@ class ReactCodeInput extends Component {
5555 }
5656
5757 UNSAFE_componentWillReceiveProps ( nextProps ) {
58+ if ( nextProps . value == null ) {
59+ return ;
60+ }
61+
5862 this . setState ( {
5963 value : nextProps . value ,
6064 } ) ;
You can’t perform that action at this time.
0 commit comments