UNPKG

react-native-ui-lib

Version:

[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://stand-with-ukraine.pp.ua)

19 lines 435 B
import React from 'react'; const useCombinedRefs = (...refs) => { const targetRef = React.useRef(); React.useEffect(() => { refs.forEach(ref => { if (!ref) { return; } if (typeof ref === 'function') { ref(targetRef.current); } else { // @ts-expect-error ref.current = targetRef.current; } }); }, [refs]); return targetRef; }; export default useCombinedRefs;