<View ref="test" style={[styles.item, {}]}></View>
const handle = findNodeHandle(this.refs.test);
UIManager.measureInWindow(handle, (x, y, width, height) => {
console.log('绝对位置x', x);
console.log('绝对位置y', y);
console.log('组件宽度', width);
console.log('组件高度', height);
})
UIManager.measure(handle ,(x, y, width, height, X, Y) => {
console.log('相对父视图位置x', x);
console.log('相对父视图位置y', y);
console.log('组件宽度', width);
console.log('组件高度', height);
console.log('绝对位置x', X);
console.log('绝对位置y', Y);
})
import {
findNodeHandle,
UIManager
} from 'react-native'