- π± In-app debugging β Debug apps in any environment without the need for debug builds.
- π Network Inspection β Monitor HTTP(S) requests (XHR, Fetch) and WebSocket connections.
- π Log Capture β Intercept console messages like log, info, warn, and error for enhanced debugging.
- β‘ Draggable Bubble UI β Seamlessly debug without disrupting your workflow.
- β¨ React Native & Expo Support β Built for compatibility across both platforms.
Install Xenon and its dependencies.
yarn add react-native-xenon
yarn add react-native-safe-area-context react-native-screens
react-native-screens
package requires one additional configuration step to properly work on Android devices. Edit MainActivity.kt
file which is located under android/app/src/main/java/<your package name>/
.
Add the highlighted code to the body of MainActivity
class:
+ import android.os.Bundle
// ...
class MainActivity: ReactActivity() {
// ...
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(null)
+ }
// ...
}
This change is required to avoid crashes related to View state being not persisted consistently across Activity restarts.
Don't forget to install pods when you are developing for iOS.
cd ios && pod install; cd ..
npx expo install react-native-xenon
npx expo install react-native-safe-area-context react-native-screens
Add Xenon.Component
in your app root component.
import Xenon from 'react-native-xenon';
function App() {
return (
<>
{/* Your other components here */}
<Xenon.Component />
</>
);
}
Present the debugger by calling the show
method.
Xenon.show();
And hide it by calling the hide
method.
Xenon.hide();
Warning
<Xenon.Component />
is enabled by default in all environments, including production. This could expose sensitive debugging tools to end users, creating potential security risks.
To avoid this, make sure to conditionally render the component only in non-production environments. For example:
{isProduction ? null : <Xenon.Component />}
Additionally, consider other approaches such as environment-based feature flags or access control to ensure only authorized users (e.g., developers) can interact with it.
Prop | Type | Description |
---|---|---|
autoInspectNetworkEnabled |
boolean |
Determines whether the network inspector is automatically enabled upon initialization. Defaults to true . |
autoInspectConsoleEnabled |
boolean |
Determines whether the console inspector is automatically enabled upon initialization. Defaults to true . |
bubbleSize |
number |
Defines the size of the interactive bubble used in the UI. Defaults to 40 . |
idleBubbleOpacity |
number |
Defines the opacity level of the bubble when it is idle. Defaults to 0.5 . |
Method | Return Type | Description |
---|---|---|
isVisible() |
boolean |
Checks whether the debugger is currently visible. |
show() |
void |
Makes the debugger visible. If it is already visible, this method has no additional effect. |
hide() |
void |
Hides the debugger. If it is already hidden, this method has no additional effect. |
To try out Xenon, you can run the example project:
# Clone the repo
git clone https://github.com/purrseus/react-native-xenon.git
cd react-native-xenon
# Install dependencies
yarn install
# Start the Expo development server
yarn example start
See the example directory for more information.
See the contributing guide to learn how to contribute to the repository and the development workflow.
This project is MIT licensed.