New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-devtools-standalone

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-devtools-standalone

Standalone React DevTools for integration with React Native

latest
Source
npmnpm
Version
0.4.1
Version published
Weekly downloads
464
-44.56%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-devtools-standalone

preview

Standalone react-devtools for integration with React Native

You can also embed react-devtools in New Debugger!

preview

Architecture

┌────────────────────┐         ┌─────────────────────┐
│ Dev Server         │         │ React Native        │
│┌──────────────────┐│         │                     │
││ (Proxy)          ││    ┌────► react-devtools-core │
││ WebSocket Server ◄─────┘    │ (WebSocket)         │
││        ▲         ││         └─────────────────────┘
││        │         ││         ┌─────────────────────────┐
││        ▼         ││         │ React DevTools Frontend │
││ WebSocket Server ◄─────┐    │                         │
│└──────────────────┘│    └────► WebSocket Client        │
└────────────────────┘         └─────────────────────────┘

Installation

npm install react-native-devtools-standalone
# or
yarn add react-native-devtools-standalone

Usage

Backend

import * as http from 'node:http';
import { setupDevToolsProxy } from 'react-native-devtools-standalone/backend';

const server = http.createServer();

const config: DevToolsProxyConfig = /* */;

setupDevToolsProxy(config);

server.listen(...);
interface DevToolsProxyConfig {
  /**
   * Configurations for client(React Native).
   */
  client?: {
    /**
     * Dev server host.
     */
    host?: string;
    /**
     * `__REACT_DEVTOOLS_PORT__` value in React Native runtime.
     *
     * @see https://github.com/facebook/react-native/blob/v0.73.5/packages/react-native/Libraries/Core/setUpReactDevTools.js#L50-L53
     *
     * Defaults to `8097`
     */
    port?: number;
    /**
     * WebSocket delegate
     */
    delegate?: ProxyWebSocketDelegate;
  };
  /**
   * Configurations for React DevTools.
   */
  devtools?: {
    /**
     * Dev server host.
     */
    host?: string;
    /**
     * Port for DevTools to connect.
     *
     * Defaults to `8098`
     */
    port?: number;
    /**
     * WebSocket delegate
     */
    delegate?: ProxyWebSocketDelegate;
  };
}

Frontend

import { setupDevTools } from 'react-native-devtools-standalone/frontend';

const config: DevToolsConfigs = {
  element: document.getElementById('container'),
  /* */
};

setupDevTools(config);
import type {
  Config as DevtoolsStoreConfig,
  DevtoolsProps,
} from 'react-devtools-inline/frontend';

interface DevToolsConfigs {
  /**
   * Element to render DevTools.
   */
  element: HTMLElement;
  /**
   * Proxy web socket server host.
   *
   * Defaults to `'localhost'`
   */
  host?: string;
  /**
   * Proxy web socket server port.
   *
   * Defaults to `8098`
   */
  port?: number;
  /**
   * React DevTools store config.
   */
  devtoolsStoreConfig?: DevtoolsStoreConfig;
  /**
   * React DevTools props.
   *
   * Defaults to `{ showTabBar: true, hideViewSourceAction: true }`
   */
  devtoolsProps?: DevtoolsProps;
  /**
   * WebSocket delegate.
   */
  delegate?: ProxyWebSocketDelegate;
}

Development

# start dev server (http://localhost:3000/index.html)
yarn start

License

MIT

FAQs

Package last updated on 10 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts