Answers for "react native detect ipad"

0

react native detect ipad

If you do not want to use any new package then use this


import { Dimensions } from 'react-native';
const {height, width} = Dimensions.get('window'); 
const aspectRatio = height/width;

if(aspectRatio>1.6) {

   // Code for Iphone

}
else {

   // Code for Ipad

}

this work fine for me
Posted by: Guest on July-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language