ReactNative get the absolute position of a view relative to the screen

Viewed 25613

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! the absolute position of a view relative to the screen

not the absolute position of a view relative to the parent view

What should I do?

2 Answers

You might want to use the "onTouchStart". it Determines the location on screen from pageX, pageY of the given view and returns the values.

<View
  onTouchStart={(e) => {console.log('touchMove', e.nativeEvent.pageY)}}
 >

a better example can be found here: https://facebook.github.io/react-native/docs/panresponder.html

Related