@malik.aliyev.94/react-native-is-iphonex

1.0.4 • Public • Published

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

Expo Demo

Here you can find statusbar, navigation bar height an other dimensions for all iOS devices

https://ivomynttinen.com/blog/ios-design-guidelines

Readme

Keywords

none

Package Sidebar

Install

npm i @malik.aliyev.94/react-native-is-iphonex

Weekly Downloads

1

Version

1.0.4

License

ISC

Unpacked Size

1.88 kB

Total Files

3

Last publish

Collaborators

  • malik.aliyev.94