UNPKG

react-native-ui-lib

Version:

<p align="center"> <img src="https://user-images.githubusercontent.com/1780255/105469025-56759000-5ca0-11eb-993d-3568c1fd54f4.png" height="250px" style="display:block"/> </p> <p align="center">UI Toolset & Components Library for React Native</p> <p a

26 lines (24 loc) 480 B
import React, { useEffect, useRef, useState } from 'react'; export default (() => { const ref = useRef(); const [measurements, setMeasurements] = useState(); const onMeasure = (x, y, width, height, pageX, pageY) => { setMeasurements({ x, y, width, height, pageX, pageY }); }; useEffect(() => { setTimeout(() => { ref.current?.measure?.(onMeasure); }, 0); }, []); return { ref, measurements }; });