允许创建开发版本并包含有用开发工具的库。
expo-dev-client
在你的调试版本中添加了各种有用的开发工具:
¥expo-dev-client
adds various useful development tools to your debug builds:
一个可配置的启动器 UI,因此你可以启动更新(例如来自 PR 预览)并在开发服务器之间切换,而无需重新编译原生应用
¥A configurable launcher UI, so you can launch updates (such as from PR previews) and switch between development servers without needing to recompile the native app
改进的调试工具(例如对 检查网络请求 的支持)
¥Improved debugging tools (such as support for inspecting network requests)
Expo 文档引用了包含 expo-dev-client
和 开发构建 的调试版本。
¥Expo documentation refers to debug builds that include expo-dev-client
as development builds.
¥Installation
-
npx expo install expo-dev-client
If you're installing this in a bare React Native app, you should also follow these additional installation instructions.
¥Configuration in app.json/app.config.js
如果你在项目中使用配置插件(EAS 构建 或 npx expo run:[android|ios]
),则可以使用其内置的 配置插件 配置开发客户端启动器。该插件允许你配置无法在运行时设置的各种属性,并且需要构建新的应用二进制文件才能生效。
¥You can configure development client launcher using its built-in config plugin if you use config plugins in your project (EAS Build or npx expo run:[android|ios]
). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect.
{
"expo": {
"plugins": [
[
"expo-dev-launcher",
{
"launchMode": "most-recent"
}
]
]
}
}
Name | Default | Description |
---|---|---|
launchMode | "most-recent" | Determines whether to launch the most recently opened project or navigate to the launcher screen.
|
import * as DevClient from 'expo-dev-client';
DevClient.isDevelopmentBuild()
A method that returns a boolean to indicate if the current application is a development build.
Returns
boolean
DevClient.registerDevMenuItems(items)
Name | Type | Description |
---|---|---|
items | ExpoDevMenuItem[] | - |
A method that allows to specify custom entries in the development client menu.
Returns
Promise<void>
ExpoDevMenuItem
An object representing the custom development client menu entry.
Name | Type | Description |
---|---|---|
callback | () => void | Callback to fire, when user selects an item. |
name | string | Name of the entry, will be used as label. |
shouldCollapse (optional) | boolean | A boolean specifying if the menu should close after the user interaction. Default: false |