bmcmahen / sancho

Responsive and accessible React UI components built with Typescript
https://sancho-ui.com
411 stars 33 forks source link

Cannot read property ref of null #61

Open AvraamMavridis opened 4 years ago

AvraamMavridis commented 4 years ago

When using Dialog the page crashes with "Cannot read property ref of null"

React Spring useTransition API has changed https://aleclarson.github.io/react-spring/v9/breaking-changes/#The-ref-prop Related issue https://github.com/react-spring/react-spring/discussions/990

HarryBurns commented 4 years ago

Seems bug is also in Toasts.tsx (more precisely in the toasted-notes sub-package), Alert/Message.tsx, Overlay.tsx and Positions.tsx.

And apparently, this bug broke my builds in production, despite the fact that the versions of the packages are fixed. I just ran npm install and it broke. Seems react-spring updated code for the already released version.

Therefore, this issue needs to be fixed as soon as possible.

HarryBurns commented 4 years ago

As a fast fix, I forced Sancho to use lower version of react-spring package. Works for me.

Just add this to package.json. Yarn required, or NPM + npm-force-resolutions plugin. See Selective dependency resolutions in Yarn

  "resolutions": {
    "sancho/react-spring": "8.0.27"
  }