This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Expo DevClient
一个用于创建开发版本并包含实用开发工具的库
expo-dev-client 为调试版本添加了各种实用的开发工具:
- 可配置的启动器 UI,因此你可以启动更新(例如来自 PR 预览的更新),并在不同开发服务器之间切换,而无需重新编译原生应用
- 改进的调试工具(例如支持检查网络请求)
- 功能强大且可扩展的开发者菜单 UI
Expo 文档将包含 expo-dev-client 的调试版本称为开发版本。
安装
使用 EAS Build 创建版本时,请在 eas.json 中的构建配置文件上将 developmentClient 设置为 true。如果不设置,EAS Build 将生成不包含开发工具的独立版本。例如:
有关更多信息,请参阅 eas.json 参考中的 developmentClient 属性。
如果你要将其安装到现有的 React Native 应用中,请先在项目中安装 expo。然后,按照在现有 React Native 项目中安装 expo-dev-client中的说明操作。
在应用配置中进行配置
如果你的项目使用配置插件(Continuous Native Generation(CNG)),则可以使用其内置的配置插件配置开发客户端启动器。该插件允许你配置各种无法在运行时设置、且必须构建新的应用二进制文件才能生效的属性。如果你的应用不使用 CNG,则需要手动配置此库。
Example app.json with config plugin
Configurable properties
TV 支持
- Android TV:支持所有操作,与 Android 手机类似
- Apple TV:支持使用本地或隧道打包器进行基本操作。目前尚不支持向 EAS 进行身份验证以及列出 EAS 版本和更新
API
import * as DevClient from 'expo-dev-client';
Methods
A method that closes development client menu when called.
voidA method that hides development client menu when called.
voidA method that opens development client menu when called.
voidSets whether the floating tools button is visible.
void