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

后端 未结 2 1394
太阳男子
太阳男子 2021-02-20 08:46

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

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-20 09:18

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

     {console.log('touchMove', e.nativeEvent.pageY)}}
     >
    

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

提交回复
热议问题