0

I'm having trouble rendering a lottie animation in Google Pixel XL and 2 XL. But I don't have that device on hand, does anyone know the width and height in react native unit? or how do you do to detect this devices?

Tom Aranda
  • 5,919
  • 11
  • 35
  • 51
  • 1
    Welcome to Stack Overflow! To give you a great answer, it might help us if you have a glance at [ask] if you haven't already. It might be also useful if you could provide a [mcve]. – Mat Jan 29 '18 at 13:57
  • You can use [`Dimensions`](https://facebook.github.io/react-native/docs/dimensions.html) from React Native for width and height. – Dan Jan 29 '18 at 14:00

1 Answers1

0

You can implement by importing Dimensions from react-native package itself as below

import { Dimensions } from 'react-native';

const window = Dimensions.get('window');
const screenHeight = window.height;
const screenWidth = window.width;

And use it appropriately inside any element

<View style={{height: screenHeight - 80}}>
HSBP
  • 735
  • 2
  • 8
  • 22