I have built a component that will determine its opening direction based on its dimension and position in the window. I used getBoundingClientRect() function on a react-dom node. Now i have updated some of project packages including react and react-dom to 16.3.2. Now I get a compile error:
Property 'getBoundingClientRect' does not exist on type 'Element | Text'
here is a piece of code that use this function:
const node = ReactDOM.findDOMNode(this.containerElement);
if (!node) {
return;
}
let vertical: Vertical_Direction;
if (verticalDirection === Vertical_Direction.DOWN_UP) {
const windowHeight = window.innerHeight;
const height: number = Math.min(containerHeight, node.getBoundingClientRect().height);
Any help or suggestion to achieve this functionality will be appreciated.
Edit2: the cause of this problem is updating @types/react-dom to 16.0.5 version.