React Native access to a variety of highly mobile phone

 

 

First, the height of the window

I.e., yellow + blue part of FIG.

import { Dimensions } from "react-native";
const deviceHeight = Dimensions.get('window').height;

Second, the screen height

FIG i.e., yellow + blue + red portion

import { Dimensions } from "react-native";
const deviceHeight = Dimensions.get('screen').height;

Third, the content height

That is shown in blue

import { StyleSheet, View, Text, ScrollView, Dimensions, PanResponder, StatusBar } from "react-native";
const deviceHeight = Dimensions.get('window').height;  
const STATUS_BAR_HEIGHT = StatusBar.currentHeight; //即图中黄色部分
const height = deviceHeight  - STATUS_BAR_HEIGHT;

 

Guess you like

Origin www.cnblogs.com/bbcfive/p/11123075.html