I know with React Native that we have the ability to determine whether iOS or Android is being run using the Platform
module, but how can we determine what device i
Simplest approach will be using the aspect ratio. The code will be:
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
}
Aspect ratio of iPad is 4:3 (1.334) and aspect ratio of iPhone is 16:9 (1.778)
Make sure to check if you are on an iOS device using Platform.OS === 'ios'
method before applying the above logic.