react-native-full-responsive
Version:
Create a fully responsive React Native app for all supported platforms
14 lines (12 loc) • 409 B
text/typescript
import { useContext } from 'react';
import type { ContextProps } from '../types';
import { FRContext } from '../context/FRProvider';
export const useDevice = () => {
const deviceContext = useContext<ContextProps | undefined>(FRContext);
if (!deviceContext) {
throw new Error(
'the device context is not found, please use FRProvider in your root component'
);
}
return deviceContext;
};