React Native:如何确定设备是 iPhone 还是 iPad [英] React Native: How to Determine if Device is iPhone or iPad

查看:126
本文介绍了React Native:如何确定设备是 iPhone 还是 iPad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道使用 React Native 我们可以使用 Platform 模块确定正在运行的是 iOS 还是 Android,但是我们如何确定 iOS 上正在使用的是什么设备?

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 is being used on iOS?

推荐答案

截至 2018 年 2 月 9 日还有

As of 9.02.2018 there is also

import { Platform } from 'react-native'
Platform.isPad // boolean

请注意(截至目前)它没有安卓版本.

Mind that (as of now) it has no android counterpart.

  • IOS https://github.com/facebook/react-native/blob/master/Libraries/Utilities/Platform.ios.js#L23
  • Android https://github.com/facebook/react-native/blob/master/Libraries/Utilities/Platform.android.js (no isPad!)

这篇关于React Native:如何确定设备是 iPhone 还是 iPad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆