File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 11{
22  "name" : " react-bootstrap-easy-dialog" 
3-   "version" : " 0.3.2 " 
3+   "version" : " 0.3.3 " 
44  "description" : " React Bootstrap Dialog made easy" 
55  "keywords" : [
66    " react-bootstrap" 
Original file line number Diff line number Diff line change @@ -167,6 +167,7 @@ export function DialogUI({
167167
168168  const  [ inputValue ,  setInputValue ]  =  useState ( "" ) ; 
169169  const  inputRef  =  useRef ( ) ; 
170+   const  submitButtonRef  =  useRef ( ) ; 
170171
171172  // only set input value to default value when it shows up 
172173  useEffect ( ( )  =>  { 
@@ -196,7 +197,11 @@ export function DialogUI({
196197  } 
197198
198199  function  handleConfirm ( )  { 
199-     onConfirm ( inputValue ) ; 
200+     if  ( submitButtonRef . current )  { 
201+       submitButtonRef . current . click ( ) ; 
202+     }  else  { 
203+       onConfirm ( ) ; 
204+     } 
200205  } 
201206
202207  function  handleHide ( )  { 
@@ -233,14 +238,15 @@ export function DialogUI({
233238          ) } 
234239          { input  &&  ( 
235240            < Form  onSubmit = { handleSubmit } > 
236-               { input  &&  ( 
237-                 < Form . Control 
238-                   { ...otherInputProps } 
239-                   value = { inputValue } 
240-                   onChange = { handleInputValueChange } 
241-                   { ...{  [ refKey ] : inputRef  } } 
242-                 /> 
243-               ) } 
241+               < Form . Control 
242+                 { ...otherInputProps } 
243+                 value = { inputValue } 
244+                 onChange = { handleInputValueChange } 
245+                 { ...{  [ refKey ] : inputRef  } } 
246+               /> 
247+               < Button  type = "submit"  hidden  ref = { submitButtonRef } > 
248+                 Submit
249+               </ Button > 
244250            </ Form > 
245251          ) } 
246252        </ Modal . Body > 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments