1- import { createRef , useCallback , useEffect , useMemo , useRef , useState } from "react" ;
1+ import { useCallback , useEffect , useMemo , useRef , useState } from "react" ;
22
33import Calendar from "../components/Calendar" ;
44import Footer from "../components/Footer" ;
@@ -93,10 +93,10 @@ const Datepicker = (props: DatepickerType) => {
9393 } ) ;
9494 const [ dayHover , setDayHover ] = useState < DateType > ( null ) ;
9595 const [ inputText , setInputText ] = useState < string > ( "" ) ;
96- const [ inputRef , setInputRef ] = useState ( createRef < HTMLInputElement > ( ) ) ;
96+ const [ input , setInput ] = useState < HTMLInputElement | null > ( null ) ;
9797
9898 // Custom Hooks use
99- useOnClickOutside ( containerRef , ( ) => {
99+ useOnClickOutside ( containerRef . current , ( ) => {
100100 const container = containerRef . current ;
101101 if ( container ) {
102102 hideDatepicker ( ) ;
@@ -313,7 +313,8 @@ const Datepicker = (props: DatepickerType) => {
313313 displayFormat,
314314 hideDatepicker,
315315 i18n : i18n && i18n . length > 0 ? i18n : LANGUAGE ,
316- input : inputRef ,
316+ input,
317+ setInput : ( value : HTMLInputElement | null ) => setInput ( value ) ,
317318 inputClassName,
318319 inputId,
319320 inputName,
@@ -336,37 +337,37 @@ const Datepicker = (props: DatepickerType) => {
336337 value
337338 } ;
338339 } , [
340+ minDate ,
341+ maxDate ,
342+ i18n ,
339343 asSingle ,
340- safePrimaryColor ,
341- configs ,
342- hideDatepicker ,
343- period ,
344- dayHover ,
345- inputText ,
346344 onChange ,
347- showFooter ,
348- placeholder ,
349- separator ,
350- i18n ,
351- value ,
352- disabled ,
353- inputClassName ,
345+ classNames ,
346+ configs ,
354347 containerClassName ,
355- toggleClassName ,
356- toggleIcon ,
357- readOnly ,
358- displayFormat ,
359- minDate ,
360- maxDate ,
361348 dateLooking ,
349+ dayHover ,
350+ disabled ,
362351 disabledDates ,
352+ displayFormat ,
353+ hideDatepicker ,
354+ input ,
355+ inputClassName ,
363356 inputId ,
364357 inputName ,
365- startWeekOn ,
366- classNames ,
367- inputRef ,
358+ inputText ,
359+ period ,
360+ placeholder ,
368361 popoverDirection ,
362+ safePrimaryColor ,
363+ readOnly ,
369364 required ,
365+ separator ,
366+ showFooter ,
367+ startWeekOn ,
368+ toggleClassName ,
369+ toggleIcon ,
370+ value ,
370371 firstGotoDate
371372 ] ) ;
372373
@@ -392,7 +393,7 @@ const Datepicker = (props: DatepickerType) => {
392393 return (
393394 < DatepickerContext . Provider value = { contextValues } >
394395 < div className = { containerClassNameOverload } ref = { containerRef } >
395- < Input setContextRef = { setInputRef } />
396+ < Input />
396397
397398 < div className = { popupClassNameOverload } ref = { calendarContainerRef } >
398399 < Arrow ref = { arrowRef } />
0 commit comments