Permalink
Find file Copy path
3ced706 Dec 7, 2018
1 contributor

Users who have contributed to this file

16 lines (12 sloc) 497 Bytes
import { isIphoneX } from "react-native-iphone-x-helper";
import { Platform, StatusBar, Dimensions } from "react-native";
const { height } = Dimensions.get("window");
export default function RF(percent: number) {
const deviceHeight = isIphoneX()
? height - 78 // iPhone X style SafeAreaView size in portrait
: Platform.OS === "android"
? height - StatusBar.currentHeight!
: height;
const heightPercent = (percent * deviceHeight) / 100;
return Math.round(heightPercent);
}