React Native - get the position of a component in a view
I am trying to get the position of a component in react native.
Let's say I have a view:
<ScrollView>
lots of items...
lots of items...
lots of items...
<View></View>
</ScrollView>
Eventually I want to eventually scroll the list to where the View is.
This link shows how to get the position using the native ui manager, however when run it returns:
"Attempted to measure a layout, but the offset or dimensions were NaN"
React Native: getting the position of an element
I tried
this.refs.VIEW.measure((ox, oy, width, height, px, py) => {
//ox ... py all = 0
});
+3
source to share