From 8e3a707f9fc00db4b83a89317245418ad95b529d Mon Sep 17 00:00:00 2001 From: youngsoohan Date: Wed, 5 Feb 2020 01:56:01 +0900 Subject: [PATCH] bump versoin string to 0.4.3 and fix landscape offset --- index.js | 11 ++++++----- package.json | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 05159f0..51b3b02 100644 --- a/index.js +++ b/index.js @@ -3,12 +3,13 @@ import { Platform, StatusBar, Dimensions } from "react-native"; const { height, width } = Dimensions.get("window"); const standardLength = width > height ? width : height; +const offset = + width > height ? 0 : Platform.OS === "ios" ? 78 : StatusBar.currentHeight; // iPhone X style SafeAreaView size in portrait -const deviceHeight = isIphoneX() - ? standardLength - 78 // iPhone X style SafeAreaView size in portrait - : Platform.OS === "android" - ? standardLength - StatusBar.currentHeight - : standardLength; +const deviceHeight = + isIphoneX() || Platform.OS === "android" + ? standardLength - offset + : standardLength; export function RFPercentage(percent) { const heightPercent = (percent * deviceHeight) / 100; diff --git a/package.json b/package.json index bf54ff8..4eae9af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-responsive-fontsize", - "version": "0.4.2", + "version": "0.4.3", "main": "index.js", "typings": "index.d.ts", "description": "Simple method for resposive fontSize based on screen-size of the device in React-Native",