Headless Dev Menu
React Native Stallion StallionDevMenu - Render the Stallion testing menu inside your own modal, screen or navigator instead of the built-in modal. Available from react-native-stallion 2.5.0.
Headless Dev Menu
Available in react-native-stallion@2.5.0:
StallionDevMenu is exported from react-native-stallion@2.5.0 and later. Upgrade with:
npm install react-native-stallion@^2.5.0
StallionDevMenu is the Stallion testing menu as a plain React component. It is the same menu the built-in modal shows, without the modal around it: you decide where it renders and how it opens and closes. Put it in your own Modal, push it as a screen in your navigator, or place it inside an internal settings page.
If the built-in modal already works for you, you don't need to change anything. useStallionModal and showModal work the same as before. See Testing framework for that setup.
When to use it
- Your app uses React Navigation (or another navigator) and you want the menu to be a screen, with your navigator's transitions and back handling.
- You want your own presentation, such as a bottom sheet, a different animation or a different safe-area treatment.
- You want the menu inside an existing internal or debug screen rather than on top of the app.
Requirements
Prerequisite:
Stallion must already be set up in the app. If it isn't, follow the SDK Installation Guide first.
- Render it inside your
withStallionroot. The menu reads its state from the provider thatwithStallion(App)adds. Anything rendered insideApp, including screens in aNavigationContainerand React NativeModals, is inside it. - Give it a sized parent. The menu fills its parent with
flex: 1and paints its own background. Inside a container with no height it renders nothing. - Handle safe areas yourself. The menu adds no safe-area insets. Wrap it in a
SafeAreaView, or render it in a screen whose header or layout already handles insets. - Render it only where Stallion is linked. When the native module is missing,
withStallionfalls back to a no-op and the menu has no state to read. Don't renderStallionDevMenuin Expo Go or in unit tests that don't mock the native module.
Props
| Prop | Type | Required | Description |
|---|---|---|---|
onClosePress | () => void | Yes | Called when the user taps the close button in the menu header. Hide the menu here: close your modal or go back. |
Render it in your own modal
This matches the built-in modal, but you own the visibility state and can change the presentation.
import React, { useState } from "react";
import { Button, Modal, SafeAreaView, View } from "react-native";
import { withStallion, StallionDevMenu } from "react-native-stallion";
const App: React.FC = () => {
const [isDevMenuVisible, setIsDevMenuVisible] = useState(false);
return (
<View style={{ flex: 1 }}>
{/* Your app */}
<Button title="Open Stallion" onPress={() => setIsDevMenuVisible(true)} />
<Modal
animationType="slide"
presentationStyle="fullScreen"
visible={isDevMenuVisible}
onRequestClose={() => setIsDevMenuVisible(false)}
>
<SafeAreaView style={{ flex: 1 }}>
<StallionDevMenu onClosePress={() => setIsDevMenuVisible(false)} />
</SafeAreaView>
</Modal>
</View>
);
};
export default withStallion(App);
onRequestClose handles the Android back button. onClosePress handles the close button inside the menu. Set both to hide the modal.
Render it as a navigation screen
With React Navigation, register the menu as a screen and close it with navigation.goBack.
import React from "react";
import { SafeAreaView } from "react-native";
import type { NativeStackScreenProps } from "@react-navigation/native-stack";
import { StallionDevMenu } from "react-native-stallion";
type Props = NativeStackScreenProps<RootStackParamList, "Stallion">;
const StallionScreen: React.FC<Props> = ({ navigation }) => (
<SafeAreaView style={{ flex: 1 }}>
<StallionDevMenu onClosePress={navigation.goBack} />
</SafeAreaView>
);
export default StallionScreen;
<Stack.Screen
name="Stallion"
component={StallionScreen}
options={{ headerShown: false, presentation: "modal" }}
/>
Hide the navigator's header: the menu has its own header with a close button. Your app root must still be wrapped with withStallion, so the NavigationContainer sits inside it.
The menu keeps its own back arrow for going from a bundle list back to the bucket list. The Android back button belongs to your navigator and closes the whole screen.
Tip:
The menu is meant for internal users. Keep the route or button that opens it behind a feature flag, an internal-only settings page or a gesture that customers won't find. The menu itself also asks for the project's SDK security PIN before showing anything. See Setup SDK Security Pin.
What the menu shows
The component renders the full testing UI. You only control where it lives.
- PIN screen on first use, until the user enters the project's SDK security PIN.
- Mode toggle to switch the device between Testing Mode (bundles from your buckets) and Production Mode (what your customers run). The switch applies on the next restart.
- Buckets in Testing Mode. Tapping a bucket opens its bundles, each with a Download button. After a download, a Restart button applies the bundle.
- Production details in Production Mode: the app version, the device's UID, the active bundle and any new bundle waiting for a restart.
Each time the menu opens it rereads the device's mode and active bundle. The bucket list loads once and is kept while the app runs. Pull down on the list to load newly published buckets.