Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null
See original GitHub issueI can’t seem to get react-sticky to work when attempting to use my own component
<StickyContainer>
<Sticky>
{({style}) => (<SearchResultsBar style={style} onFilterClick={this.props.handleFilterClick} />)}
</Sticky>
...
</StickyContainer>
When I attempt the above I get Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null
at Sticky.js:61
.
var contentClientRect = _this.content.getBoundingClientRect();
If I do the above, but don’t attempt to pass any of my own props, and just return the component by name it works:
<StickyContainer>
<Sticky>
{SearchResultsBar}
</Sticky>
...
</StickyContainer>
I’m assuming I’m missing something simple, but I don’t know what it is. The SearchResultsBar
is a stateless functional component if that makes a difference. This is using 6.0.1
.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:11 (4 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'getBoundingClientRect' of null
I'm trying to create a header with a Sticky effect, but I'm having this error when scrolling the page, sometimes it works and...
Read more >Cannot read property 'getBoundingClientRect' of null · Issue ...
I am creating a slider it does render the component and the styles however I do get a js error: Uncaught TypeError: Cannot...
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 >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 only...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dbarbalato, I actually just got finished trying that, and it appears to work correctly as a class extending
Component
.If it helps anyone, forwarding the rest of the props to a wrapping div seems to fix the problem