📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

@react-native-sandbox/controls

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-sandbox/controls

A plugin for react-native-sandbox to enable support for controls

0.1.21
latest
Source
npm
Version published
Weekly downloads
1.2K
-16.45%
Maintainers
1
Weekly downloads
 
Created
Source

Adds sandbox controls to react-native-sandbox to quickly manipulate component properties directly in the UI.

Installation

Requires react-native-sandbox. Ensure that your sandbox is configured correctly before proceeding.

Open a terminal in your project's folder and run

npm install @react-native-sandbox/controls

Modify your sandbox root to load the plugin:

import ControlsPlugin from '@react-native-sandbox/controls';

// ...

function Sandbox() {
    return <SandboxRoot components={comonents} plugins={[ControlsPlugin]}>;
}

Usage

Controls are added to a sandbox by simply invoking the appropriate hook for the desired control. Controls are rendered in the order that the hooks are invoked.

import MyComponent from './MyComponent';
import { useText, useDivider, useNumber } from '@react-native-sandbox/controls';

function MyComponentSandbox() {
    // render a text input control first
    const label = useText("Custom Label", "My Component");

    // render a divider next
    useDivider();

    // render a number input control last
    const num = useNumber("Custom Number", 0);

    return (<MyComponent label={label} value={num} />);
}

The built-in controls are the following:

TypeHookDescription
BooleanuseBooleanA switch control for boolean props
ColoruseColorA color picker
DivideruseDividerA divider in the component control panel
InfouseInfoA info block to display useful information
LabeluseLabelA label to display in component control panel
NumberuseNumberA number input
ObjectuseObjectA text input control for JSON objects
SelectuseSelectA value selector
TextuseTextA text input

Demo

Custom Controls

Coming soon

Keywords

sandbox

FAQs

Package last updated on 17 Oct 2022

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