reactjsreact-nativereact-native-device-info

React Native Pixel Density issue with Pixel 2 XL (react-native-device-info)


Apparently when you set your device's display size to small react-native-device-info library thought that it's a tablet and according to that all the layouts and everything starting to act like tablets and my images aren't visible anymore. Does anyone having the same problem? Any suggestions?


Solution

  • Okay, I got it. With this new high density phones for example Google Pixel 2 XL or nexus or something like that some phone that you can change your display size to small. When you do that react native behave that your phone is a tablet and showing the tablet layout on that phone. So I actually checked some of the devices densities and there is not a single tablet over 2.0 density.

     PixelRatio.get() < 2 ? DeviceInfo.isTablet : () => false
    

    This is working for me if anyone is intrested.