Kiarash-Z / react-modern-calendar-datepicker

A modern, beautiful, customizable date picker for React
https://kiarash-z.github.io/react-modern-calendar-datepicker/
MIT License
1.02k stars 217 forks source link

T.current is null #234

Open elyasmotazedy opened 3 years ago

elyasmotazedy commented 3 years ago

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

rogreyroom commented 3 years ago

same issue here on react ver. 17.0.1

josegoval commented 3 years ago

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"

norama commented 3 years ago

Samoe for me in a webapp and firefox crashes

Mokafela commented 3 years ago

same here help!

prajyotmayekar commented 3 years ago

same issue with Next.js 10.0.7

aparsapour commented 3 years ago

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

DimitarDevP commented 3 years ago

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

rferdosi commented 3 years ago

Same issue on next 11.0.1

DimitarDevP commented 3 years ago

Still no news from devs? Has anyone solved this?

sama20 commented 3 years ago

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

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

amir04lm26 commented 2 years ago

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