danistefanovic/react-lazy-hero

Bug in a TypeScript Project

YannickLeRoux opened this issue · 6 comments

I am in the process of migrating my portfolio from a regular CRA application to a CRA-typescript app.

I am having issue with this LazyHero, as the background image is not displayed and this error pops up in the console:

LazyHero.js:167 Uncaught TypeError: Cannot read property 'offsetHeight' of undefined
    at LazyHero.updateSize (LazyHero.js:167)
    at Image.image.onload (LazyHero.js:156)

I am new to TypeScript so it might be a problem with type declarations (maybe not). I just added a simple declare module 'react-lazy-hero'; to have the app not crash, but might be not enough to have it work properly.
Any advice ?

Would you be able to set up a reproduction repo? Thanks!

Please try to downgrade to styled-components v3.

react-lazy-hero@2.0.0 should fix the issue.

That was it thank you!

Awesome!