react-native-photos-gallery
Version:
A React Native animated custom photo gallery component
17 lines • 469 B
JavaScript
import { useEffect, useRef } from 'react';
const useForwardRef = (ref, initialValue = null) => {
const targetRef = useRef(initialValue);
useEffect(() => {
if (!ref)
return;
if (typeof ref === 'function') {
ref(targetRef.current);
}
else {
ref.current = targetRef.current;
}
}, [ref]);
return targetRef;
};
export default useForwardRef;
//# sourceMappingURL=useForwardRef.js.map