with react native.
I can get the position and size with onLayout
, but I want to get the absolute position of a view relative to the screen
please! t
you can use measure(callback) it Determines the location on screen, width, and height of the given view and returns the values via an async callback.
a better example can be found here React Native: Getting the position of an element
{ this.marker = ref }}
onLayout={({nativeEvent}) => {
if (this.marker) {
this.marker.measure((x, y, width, height, pageX, pageY) => {
console.log(x, y, width, height, pageX, pageY);
})
}
}}
>