This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Expo NavigationBar
一个库,提供对 Android 上原生导航栏的各种交互的访问。
expo-navigation-bar 提供了一个组件和命令式 API,用于控制 Android 设备上的应用导航栏,允许你更改其按钮的颜色或隐藏它。
安装
🌐 Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
应用配置中的配置
🌐 Configuration in app config
如果你在项目中使用配置插件(连续原生生成 (CNG)),可以使用其内置的 配置插件 来配置 expo-navigation-bar。该插件允许你配置无法在运行时设置并且需要构建新的应用二进制文件才能生效的各种属性。如果你的应用不使用 CNG,那么你需要手动配置该库。
🌐 You can configure expo-navigation-bar using its built-in config plugin if you use config plugins in your project (Continuous Native Generation (CNG)). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does not use CNG, then you'll need to manually configure the library.
Example app.json with config plugin
Configurable properties
Are you using this library in an existing React Native app?
如果你没有使用连续本地生成(CNG)或者你正在手动使用一个原生 Android 项目,那么你需要将以下配置添加到你的原生项目中:
🌐 If you're not using Continuous Native Generation (CNG) or you're using a native android project manually, then you need to add the following configuration to your native project:
-
要在 Android 上隐藏导航栏,请在 android/app/src/main/res/values/styles.xml 中添加
expoNavigationBarHidden:<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar"> <!-- ... --> <item name="expoNavigationBarHidden">true</item> </style>
用法
🌐 Usage
应用接口
🌐 API
import { NavigationBar } from 'expo-navigation-bar';
No API data file found, sorry!