UNPKG

react-native-wlkt

Version:

Simple and fully customizable walkthrough guide for your app

15 lines (10 loc) 332 B
import React, { useState, useCallback } from 'react'; const useComponentSize = () => { const [size, setSize] = useState(null); const onLayout = useCallback(event => { const { width, height } = event.nativeEvent.layout; setSize({ width, height }); }, []); return [size, onLayout]; }; export { useComponentSize };