Skip to content

How to configure background? #301

Answered by dannyhw
levino asked this question in Q&A
Nov 30, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

There is no preview js in the 5.x of storybook. Instead you use the functions like addDecorator and addParameters.

For example with the backgrounds addon you can do:

import { getStorybookUI, configure, addParameters, addDecorator } from '@storybook/react-native';
import './rn-addons';
import { withBackgrounds } from '@storybook/addon-ondevice-backgrounds';

addDecorator(withBackgrounds);

addParameters({
  backgrounds: [
    { name: 'dark', value: '#222222' },
    { name: 'white', value: '#ffffff', default: true },
  ],
});

you can find this example in the 5.3 example project here
https://github.com/storybookjs/react-native/blob/v5.3.25/examples/native/storybook/index.js

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@levino
Comment options

Answer selected by levino
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants