concept device in category react native
appears as: device, device

This is an excerpt from Manning's book React Native in Action.
Listing 9.6 Using Dimensions to retrieve the width and height of the device
import React, { Component } from 'react' import { View, Text, Dimensions, StyleSheet } from 'react-native' #1 let styles = {} const { width, height } = Dimensions.get('window') #2 const windowWidth = Dimensions.get('window').width #3 const App = () => ( <View style={styles.container}> #4 <Text>{width}</Text> <Text>{height}</Text> <Text>{windowWidth}</Text> </View> ) styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center' } }) #1 Imports Dimensions from React Native #2 Destructures the width and height #3 Accesses the width object property directly #4 In the View, render the dimensions that were stored in the variables you retrieved off the Dimensions.get method.