@react-native-sandbox/grid

0.1.21 • Public • Published

Adds a grid to react-native-sandbox.

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/grid

Modify your sandbox root to load the plugin:

import GridPlugin from '@react-native-sandbox/grid';

// ...

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

Usage

By default all sandboxes will now have the grid actions added to the toolbar. Tapping the icon will iterate over the different size configurations. (disabled, 10, 20, 50) You can also toggle between a line grid and a dot grid.

Demo

To disable grid on a given sandbox you can provide a plugin configuration:

import MyComponent from './MyComponent';
import { useDocs } from '@react-native-sandbox/docs';
import documentation from './documentation.txt';


function MyComponentSandbox() { /* ... */ }

export default {
    name: 'My Component Sandbox',
    components: {
        MyComponentSandbox: {
            component: MyComponentSandbox,
            plugins: {
                grid: false,
            }
        }
    }
}

Configuration

The plugin can be configured as follows:

import GridPlugin from '@react-native-sandbox/grid';

// ...

const plugin = GridPlugin.configure(options);

Where the following options are available:

Key Type Description
gridColor string Global override for the default grid color.
defaultType "line", "dot" Default grid type to use.

Package Sidebar

Install

npm i @react-native-sandbox/grid

Weekly Downloads

1,237

Version

0.1.21

License

ISC

Unpacked Size

17.4 kB

Total Files

16

Last publish

Collaborators

  • rpenf