3.1.2 • Published 3 days ago

@storybook/native-addon v3.1.2

Weekly downloads
42
License
MIT
Repository
github
Last release
3 days ago

@storybook/native-addon

This module contains an addon that can be used to interact with the appetize.io emulator.
Currently, it lets you rotate the emulator left or right, take screenshots, and change the device that is being emulated.

Installation

npm install @storybook/native-addon or yarn add @storybook/native-addon

Usage

Add "@storybook/native-addon/dist/register.js" to the addons section of your main.js file.

Add the following to your preview.js file:

import { DeviceDecorator } from "@storybook/native-addon";

export const decorators = [DeviceDecorator];

An example main.js can be found here.
An example preview.js can be found here.

Network Logs

If you want to use the network logs panel you need to a config the previewHead of your storybook , it will make sure that the Appetize SDK is fetched and setup

Update your main.js file with the following code:

import { nativePreviewHead } from "@storybook/native";

const  config = {
    stories: ["../stories/*.stories.jsx"],
    framework: {
        name: "@storybook/react-webpack5",
        options: {},
    },
    addons: [
        "@storybook/addon-docs",
        "@storybook/addon-controls",
        "@storybook/native-addon/dist/register.js"
    ],
    docs: {
        autodocs: true
    },
    previewHead: nativePreviewHead,

};

export default config;

Google Map API Key

If you want to use the map addon panel you need to a global Google map api key, You can get one here

After you get the api key you can update the preview.js file with the following code:

const preview = {
    globalTypes: {
        location: {
            description: 'Device Location',
            defaultValue: getGlobalLocationJson(
                {
                    googleMapsApiKey: "<you-api-key>"
                }
            )
        },
    },
    decorators: [DeviceDecorator]
};

export default preview;
3.1.2

3 days ago

3.1.1

8 days ago

3.1.0

2 months ago

3.0.1

4 months ago

3.0.0

5 months ago

2.2.8

1 year ago

2.2.7

2 years ago

2.2.6

2 years ago

2.2.5

2 years ago

2.2.4

2 years ago

2.2.3

2 years ago

2.2.1

2 years ago

2.2.2

2 years ago

2.2.0

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.9

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.8

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.0

3 years ago