question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Native: Backgrounds addon

See original GitHub issue

Describe the bug

The backgrounds addon for ondevice doesn’t work as expected. I’ve seen several issues:

  1. When combined with the knobs addon and importing the backgrounds addon first, an error is thrown:

TypeError: null is not an object (β€˜evaluating this.state.selection’).

I see duplicate dependencies (nested node_modules) so perhaps something hasn’t been updated yet? For some reason this.state is null in the BackgroundPanel.render().

  1. Once loaded, the background colour I set as a default is shown, but there’s no panel for me to change the background colour and thus I can only ever see one of the colours. I do think the two issues are related.

To Reproduce

This is a new React Native project with all the latest versions of storybook (@next). It’s all basic quick start stuff (addons file, and decorators).

Expected behavior

A way to toggle the background colour.

System:

  • Device: iPhone X
  • Framework: React Native
  • Addons: Knobs and backgrounds
  • Version: See additional

Additional context

A dump of all storybook related packages and their versions:

mixed/efteling-app [ yarn list | grep storybook                                                                                              feature/APP-2743-storybook * ] 10:49 AM
β”œβ”€ @storybook/addon-actions@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/addons@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/api@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/client-api@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/components@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/core-events@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/theming@5.2.0-beta.0
β”œβ”€ @storybook/addon-backgrounds@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/addons@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/api@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/client-logger@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/components@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/core-events@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/theming@5.2.0-beta.0
β”œβ”€ @storybook/addon-knobs@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/addons@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/client-api@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/components@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/core-events@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/theming@5.2.0-beta.0
β”œβ”€ @storybook/addon-ondevice-actions@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/addons@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/core-events@5.2.0-beta.0
β”œβ”€ @storybook/addon-ondevice-backgrounds@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/addons@5.2.0-beta.0
β”œβ”€ @storybook/addon-ondevice-knobs@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/addons@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/core-events@5.2.0-beta.0
β”œβ”€ @storybook/addon-storyshots@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/addons@5.2.0-beta.0
β”œβ”€ @storybook/addons@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/api@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/channels@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/client-logger@5.2.0-beta.0
β”œβ”€ @storybook/api@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/channels@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/client-logger@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/core-events@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/router@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/theming@5.2.0-beta.0
β”œβ”€ @storybook/channel-postmessage@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/channels@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/client-logger@5.2.0-beta.0
β”œβ”€ @storybook/channel-websocket@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/channels@5.2.0-beta.0
β”œβ”€ @storybook/channels@5.2.0-beta.0
β”œβ”€ @storybook/client-api@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/addons@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/channel-postmessage@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/channels@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/client-logger@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/core-events@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/router@5.2.0-beta.0
β”œβ”€ @storybook/client-logger@5.2.0-beta.0
β”œβ”€ @storybook/components@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/client-logger@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/theming@5.2.0-beta.0
β”œβ”€ @storybook/core-events@5.2.0-beta.0
β”œβ”€ @storybook/react-native@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/addons@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/channel-websocket@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/channels@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/client-api@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/core-events@5.2.0-beta.0
β”œβ”€ @storybook/router@5.2.0-beta.0
β”œβ”€ @storybook/theming@5.2.0-beta.0
β”‚  β”œβ”€ @storybook/client-logger@5.2.0-beta.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
RWOverdijkcommented, Jul 17, 2019

Both issues have been fixed through #7437

1reaction
shilmancommented, Jul 18, 2019

@RWOverdijk More the former than the later, I assure you 😘

Read more comments on GitHub >

github_iconTop Results From Across the Web

@storybook/addon-ondevice-backgrounds - npm
A react-native storybook addon to show different backgrounds for your preview. Latest version: 5.3.23, last published: 2 years ago.
Read more >
storybook/addon-ondevice-backgrounds
A react-native storybook addon to show different backgrounds for your preview. ... With Storybook for React Native you can design and develop individualΒ ......
Read more >
Two Easy Ways to Add React Native Background Image
The ultimate guide to adding a react native background image to your application with two straightforward different approaches.
Read more >
@storybook/addon-backgrounds | Yarn - Package Manager
Storybook Addon Backgrounds can be used to change background colors inside the preview in Storybook. Framework Support. React Storybook ScreenshotΒ ...
Read more >
Channel Background Customization - React Native SDK Docs
Basic Custom Background#. You can change the background statically by wrapping MessageList and MessageInput with the ImageBackground component. Also make sureΒ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found