A development tool to explore, inspect, and diagnose your React Native apps.
—
Creates an overlay system for displaying debugging information directly in your React Native app interface, allowing real-time visual debugging without leaving the app.
Creates a plugin that provides a React component overlay system for displaying debugging information sent from Reactotron.
/**
* Create debug overlay plugin
* @returns Plugin creator function (no configuration options)
*/
function overlay(): PluginCreator;Usage Examples:
import Reactotron, { overlay } from "reactotron-react-native";
// Basic overlay setup
const reactotron = Reactotron
.configure({ name: "MyApp" })
.use(overlay())
.connect();
// Via useReactNative
const reactotron = Reactotron
.configure({ name: "MyApp" })
.useReactNative({
overlay: true
})
.connect();The overlay plugin provides a React component wrapper for integrating the debug overlay into your app.
/**
* Overlay plugin features
*/
interface OverlayFeatures {
/**
* Higher-order component that wraps your app with debug overlay
* @param WrappedComponent - Your root app component
* @returns Enhanced component with overlay functionality
*/
overlay: (WrappedComponent: React.ComponentType) => (props?: Record<string, any>) => React.ReactElement;
}Usage Examples:
import React from "react";
import { Text, View } from "react-native";
import Reactotron from "reactotron-react-native";
// Your app component
const MyApp = () => (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>My React Native App</Text>
</View>
);
// Wrap with overlay (only in development)
const App = __DEV__ ? Reactotron.overlay(MyApp) : MyApp;
export default App;The overlay responds to commands from Reactotron desktop to show debug information:
/**
* Command to display overlay with debugging information
*/
interface OverlayCommand {
type: "overlay";
payload: any; // Debug information to display
}The overlay uses a Higher-Order Component pattern to wrap your existing app:
// Generated component structure
const OverlayWrapper = (props = {}) => (
<View style={{ flex: 1 }}>
<WrappedComponent {...props} />
<FullScreenOverlay emitter={emitter} />
</View>
);The overlay renders as a full-screen component that doesn't interfere with your app's functionality:
/**
* Full screen overlay component props
*/
interface FullScreenOverlayProps {
emitter: Emitter; // Event emitter for receiving overlay commands
}The overlay plugin uses the mitt library for event communication:
/**
* Overlay event emitter
*/
interface OverlayEmitter {
/** Listen for overlay events */
on(type: "overlay", handler: (payload: any) => void): void;
/** Remove overlay event listener */
off(type: "overlay", handler: (payload: any) => void): void;
/** Emit overlay event */
emit(type: "overlay", payload: any): void;
}The plugin processes overlay commands and forwards them to the React component:
// Command handling
onCommand: (command) => {
if (command.type === "overlay") {
emitter.emit("overlay", command.payload);
}
}The overlay component is designed to:
The overlay leverages React Native's component system:
import React from "react";
import { View } from "react-native";
import mitt from "mitt";The overlay includes proper event cleanup:
// Event emitter cleanup
useEffect(() => {
const handler = (payload) => {
// Handle overlay display
};
emitter.on("overlay", handler);
return () => {
emitter.off("overlay", handler);
};
}, []);import Reactotron from "reactotron-react-native";
const MyApp = () => {
// Your app code
};
// Only add overlay in development
const App = (__DEV__ && Reactotron.overlay) ?
Reactotron.overlay(MyApp) :
MyApp;
export default App;import { Platform } from "react-native";
import Reactotron from "reactotron-react-native";
const MyApp = () => {
// Your app code
};
// Platform-specific overlay
const shouldUseOverlay = __DEV__ && Platform.OS === 'ios';
const App = shouldUseOverlay ? Reactotron.overlay(MyApp) : MyApp;
export default App;import Reactotron from "reactotron-react-native";
import { Provider } from "react-redux";
import { NavigationContainer } from "@react-navigation/native";
const BaseApp = () => (
<NavigationContainer>
{/* Your app navigation */}
</NavigationContainer>
);
// Chain HOCs
let App = BaseApp;
// Add Redux provider
App = (props) => (
<Provider store={store}>
<BaseApp {...props} />
</Provider>
);
// Add Reactotron overlay (development only)
if (__DEV__) {
App = Reactotron.overlay(App);
}
export default App;The overlay can display various types of debugging information:
Usage Best Practices:
// Safe overlay integration
const setupOverlay = (Component) => {
if (!__DEV__) return Component;
try {
return Reactotron.overlay ? Reactotron.overlay(Component) : Component;
} catch (error) {
console.warn("Reactotron overlay setup failed:", error);
return Component;
}
};
const App = setupOverlay(MyAppComponent);Install with Tessl CLI
npx tessl i tessl/npm-reactotron-react-native