Bug in a TypeScript Project
YannickLeRoux opened this issue · 6 comments
YannickLeRoux commented
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 ?
danistefanovic commented
Would you be able to set up a reproduction repo? Thanks!
YannickLeRoux commented
of course,
https://github.com/YannickLeRoux/portfolio-typescript
Thank you
danistefanovic commented
Please try to downgrade to styled-components v3.
danistefanovic commented
react-lazy-hero@2.0.0
should fix the issue.
YannickLeRoux commented
That was it thank you!
danistefanovic commented
Awesome!