@malik.aliyev.94/react-native-is-iphonex
v1.0.4
Published
Just copy this lines of code and use in your react-native app.
Downloads
1
Readme
Never install this package :)
Just copy this lines of code and use in your react-native app.
import { Platform, Dimensions } from "react-native";
const isIphoneX =
Platform.OS === "ios" && Dimensions.get("window").height === 812 && Dimensions.get("window").width === 375;
The usage example is shown below, if you still want to install this package ))
To install run the command in terminal:
yarn add @malik.aliyev.94/react-native-is-iphonex
or
npm i @malik.aliyev.94/react-native-is-iphonex
Then import this package in your script:
import isIphoneX from '@malik.aliyev.94/react-native-is-iphonex';
isIphoneX is true is the device is iPhoneX.
You can use this package to set the height of the statusbar, for example:
import isIphoneX from '@malik.aliyev.94/react-native-is-iphonex';
const statusBarHeight = isIphoneX ? 44 : 20;
Bonus
See React Native Starter project on GitHub.
The Demo is available on Expo
Here you can find statusbar, navigation bar height an other dimensions for all iOS devices
https://ivomynttinen.com/blog/ios-design-guidelines