Storybook: Default text and background are the same color on react native 0.58

Created on 27 Jan 2019  路  6Comments  路  Source: storybookjs/storybook

Describe the bug
In react native 58+, the default background color is black instead of white, and so the default UI theming that comes out of the box with storybook UI is invisible

To Reproduce
Steps to reproduce the behavior:
Follow the instructions to install storybook on a newly created react native project
react-native init newProject
cd newProject
npx -p @storybook/cli sb init

Expected behavior
Expected the default text color to not be the same as the background

Screenshots
screen shot 2019-01-26 at 11 26 39 pm

Code snippets
adding this to the style file for the preview list component shows the ui

flex: {
    backgroundColor: 'white',
    flex: 1
  },

screen shot 2019-01-26 at 11 26 46 pm

System:

  • MacOS
  • Device: Macbook pro 2015
  • Framework: react native
  • Version: 4.1.11
react-native bug has workaround

Most helpful comment

For me I realized it's caused by this line in AppDelegate.m for 0.58.x
It becomes
rootView.backgroundColor = [UIColor blackColor];
whereas previously it's
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

Now I changed it to
rootView.backgroundColor = [UIColor whiteColor];
and it defaults to white again

All 6 comments

For me I realized it's caused by this line in AppDelegate.m for 0.58.x
It becomes
rootView.backgroundColor = [UIColor blackColor];
whereas previously it's
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

Now I changed it to
rootView.backgroundColor = [UIColor whiteColor];
and it defaults to white again

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Non-intrusive workaround is to wrap the StorybookUIRoot component inside a View with its background color set to white:

const WrappedStorybook = () => (
  <View style={{ flex: 1, backgroundColor: "white" }}>
    <StorybookUIRoot />
  </View>
);

what a hack. is there official issue to change this? why is default black?

Was this page helpful?
0 / 5 - 0 ratings