0.3.1 • Published 7 years ago
react-native-size-classes v0.3.1
react-native-size-classes
Get the UIKit UIWindow values for UITraitCollection vertical and horizontal size classes in iOS. Safe for Android (it's a no-op).
Installation
Using npm:
npm install --save react-native-size-classesUsing yarn:
yarn add react-native-size-classesLinking
Automatic
react-native link react-native-size-classesor with rnpm:
rnpm link react-native-size-classesUsage
import SizeClasses from 'react-native-size-classes'API
The API currently supports iOS only. You'll probably want to wrap calls in Platform.OS or Platform.select().
getSizeClasses()
Uses the UIWindow to return a Promise that resolves values for vertialSizeClass and horizontalSizeClass for the overall app.
Examples
SizeClasses.getSizeClasses().then((sc) => console.log(sc.vertical))isIpad()
Uses the UIWindow value for userInterfaceIdiom to determine if this device is an iPad or not.
Examples
const isIpad = SizeClasses.isIpad(); //true