'Is there any way to get exact coordinate of a component in react native like that it's possible in html using element.getBoundingClientRect();

  1. I have tried this way
  2.     const layout = event.nativeEvent.layout;
    
        console.log(
          "height:",
          layout.height,
        );
        console.log("width:", layout.width);
        console.log("x:", layout.x);
        console.log("y:", layout.y);
        if(index==0 && firstRender==true)
    
      }}```
    
    

But got x=0, y=0 in every case.

  1. I have also tried measure() function for the same.

Is it even possible to find exact coordinates in react native or not ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source