This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Expo 设备 iconExpo 设备

通用库提供对有关物理设备的系统信息的访问。

Android
iOS
tvOS
Web
Included in Expo Go
Recommended version:
~58.0.5

expo-device 提供对物理设备系统信息的访问,例如其制造商和型号。

安装

🌐 Installation

Terminal
- npx expo install expo-device
- yarn expo install expo-device
- pnpm expo install expo-device
- bun expo install expo-device

If you are installing this in an existing React Native app, make sure to install expo in your project.

用法

🌐 Usage

Basic Device usage
import { Text, View } from 'react-native'; import * as Device from 'expo-device'; export default function App() { return ( <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> <Text> {Device.manufacturer}: {Device.modelName} </Text> </View> ); }

应用接口

🌐 API

import * as Device from 'expo-device';

No API data file found, sorry!

错误代码

🌐 Error codes

代码描述
ERR_DEVICE_ROOT_DETECTION针对 isRootedExperimentalAsync 抛出的错误代码。如果对某些系统文件没有读取权限,可能会抛出此错误。