react-modern-calendar-datepicker icon indicating copy to clipboard operation
react-modern-calendar-datepicker copied to clipboard

T.current is null

Open elyasmotazedy opened this issue 4 years ago • 11 comments

Describe the bug hi, I'm using this in nextjs but why I get T.current is null and I use it like a document nothing extra added to it.

My code import 'react-modern-calendar-datepicker/lib/DatePicker.css'; import DatePicker from 'react-modern-calendar-datepicker'; const [selectedDay, setSelectedDay] = useState(null);

        <DatePicker
          value={selectedDay}
          onChange={setSelectedDay}
          shouldHighlightWeekends
          locale="fa" // add this
        />

I'm using react 17.0.1

elyasmotazedy avatar Feb 12 '21 16:02 elyasmotazedy

same issue here on react ver. 17.0.1

rogreyroom avatar Feb 28 '21 10:02 rogreyroom

Same issue here, with this code using react-hook-form:

<Controller
        name={labelLocaleId}
        control={control}
        rules={{ required: required }}
        render={({ onChange, value, name, ref }) => (
          <DatePicker
            inputRef={ref}
            inputName={name}
            onChange={onChange}
            value={value}
          />
        )}
      />

ver: "react": "^17.0.1"

josegoval avatar Mar 24 '21 09:03 josegoval

Samoe for me in a webapp and firefox crashes

norama avatar May 06 '21 15:05 norama

same here help!

Mokafela avatar Jul 18 '21 19:07 Mokafela

same issue with Next.js 10.0.7

prajyotmayekar avatar Jul 21 '21 14:07 prajyotmayekar

I'm using react 17.0.1 & have the same issue in FireFox, But Not in Chrome (Both are the latest version!

aparsapour avatar Aug 01 '21 10:08 aparsapour

Same here on react@^17.0.2. Weird thing is that it happens on Firefox but not on Chrome.

DimitarDevP avatar Aug 12 '21 12:08 DimitarDevP

Same issue on next 11.0.1

rferdosi avatar Aug 20 '21 11:08 rferdosi

Still no news from devs? Has anyone solved this?

DimitarDevP avatar Aug 20 '21 12:08 DimitarDevP

I don't know this helps others or not but I had this problem and did these:

  • unminify index.js in lib

  • change the this line:

T.current.removeEventListener("keyup", e, !1);

to this:

if(T.current)  T.current.removeEventListener("keyup", e, !1);

NOTE: After that you should restart react server to load your changes: npm start or yarn start

sama20 avatar Aug 23 '21 19:08 sama20

Here's the solution: https://github.com/Kiarash-Z/react-modern-calendar-datepicker/issues/284#issuecomment-950307226

amir04lm26 avatar Oct 24 '21 11:10 amir04lm26