diegomura / diegomura/react-pdf
How to check if a component touches another?
- Dominant language
- TypeScript
- Stars
- 16.8k
- Forks
- 1.3k
- Avg merge
- 5h 6m
- Merged PRs (30d)
- 52
Description
Is it possible to determine whether two View components overlap or collide with each other. I'm trying to check whether if a component touches the page footer so that I could break the component into two parts and display them on two different pages?
I've tried to using getBoundingClientRect() to check for collision but the function returns DOMRect {x: 0, y: 0, width: 0, height: 0, top: 0, …} for components contained inside PDFViewer.

Browser: Chrome 93
@react-pdf/renderer version: 2.0.19
React version: 17.0.2
Contributor guide
Assessment
This issue has not been assessed yet.