This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).
Expo DevMenu
A library that provides a developer menu for debug builds.
The expo-dev-menu can be used as a standalone library in any Expo project. It is especially useful in brownfield apps that don't need the full expo-dev-client launcher interface.
expo-dev-menu provides a developer menu UI for React Native apps that includes:
- A powerful and extensible menu UI accessible via shake gesture or three-finger long press
- Quick access to common development actions
- Support for custom menu items to extend functionality
Installation
-Â npx expo install expo-dev-menuIf you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Once installed, the developer menu is available in your debug builds. You can open it by:
- Shake gesture: Shake your device
- Three-finger long press: Long press with three fingers on the screen
- Programmatically: Call
DevMenu.openMenu()from your code
Extending the dev menu
The dev menu can be extended to include extra buttons by using the registerDevMenuItems API:
import { registerDevMenuItems } from 'expo-dev-menu'; const devMenuItems = [ { name: 'My Custom Button', callback: () => console.log('Hello world!'), }, ]; registerDevMenuItems(devMenuItems);
This will create a new section in the dev menu that includes the buttons you have registered:
Note: Subsequent calls of
registerDevMenuItemswill override all previous entries.
Using with expo-dev-client
If you are using development builds, install expo-dev-client instead. It includes expo-dev-menu along with additional development tools:
- A configurable launcher UI for switching between development servers
- Improved debugging tools
- Support for loading updates from EAS Update
-Â npx expo install expo-dev-clientFor more information, check the expo-dev-client reference.
API
import * as DevMenu from 'expo-dev-menu';
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.
void| Parameter | Type |
|---|---|
| items | ExpoDevMenuItem[] |
A method that allows to specify custom entries in the development client menu.
Promise<void>Types
An object representing the custom development client menu entry.
| Property | 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 |