question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'getBoundingClientRect' of null

See original GitHub issue

Not sure how it the fix here 328, I did this:


render() {
  let imgTpl = (images || []).map((image, index) => {
     return (
     <div key={image.Id} >
        <img src={image.url}  /></div>
     );
  });
}

return(
  <Slider {...settings}>
    { imgTpl }
   </Slider>
)

There is a div around the image items but it still does not work.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:35 (6 by maintainers)

github_iconTop GitHub Comments

75reactions
cmmartincommented, Nov 26, 2016

This happens anytime your slides are custom React components. For example, this doesn’t work…

<Slider>
{ slides.map(slide => <CustomSlide />) }
</Slider> 

This works…

<Slider>
{ slides.map(slide => <div><CustomSlide /></div>) }
</Slider> 

this.list ref doesn’t get set

19reactions
akirancommented, Nov 25, 2016

Make sure imgDivs is not empty inside Slider

{imgDivs.length > 0 ? <Slider {...settings}>{imgDivs}</Slider>: null}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'getBoundingClientRect' of null
I get this error: Cannot read property 'getBoundingClientRect' of null . I use this function getBoundingClientRect , because in my project I ...
Read more >
Cannot read property 'getBoundingClientRect' of null #100
Hi! I'm getting sometimes this error in console Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null How can I fix this?
Read more >
Throwing Cannot read property 'getBoundingClientRect' of ...
The error keeps coming from Sentry from a user using windows xp and chrome v49.0.2623, and several users using windows 10 and Edge...
Read more >
TypeError: Cannot read property 'getBoundingClientRect' of null
Hi,. The issue I am experiencing looks similar to (see link below), except I am using the angular 2+ diagrams component. ... It...
Read more >
TypeError: Cannot read property 'getBoundingClientRect' of null
Suspected problems and effort to solve this: Error message: I get the same error message “TypeError: Cannot read property 'getBoundingClientRect' of null” from ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found