UNPKG

@s20.ai/safecam-360-rn-lite

Version:

A React Native component to view the interior panorama and exterior 360 degree views of a product featuring suppport for hotspots. Compatible with Android and iOS

18 lines (16 loc) 504 B
import {useEffect, useState} from 'react'; import {Dimensions} from 'react-native'; export default useOrentation = () => { const [screenInfo, setScreenInfo] = useState(Dimensions.get('screen')); useEffect(() => { const onChange = result => { setScreenInfo(result.screen); }; let subscription = Dimensions.addEventListener('change', onChange); return () => subscription.remove(); }); return { ...screenInfo, isPortrait: screenInfo.height > screenInfo.width, }; };