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.

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

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

10reactions
kdenzcommented, Feb 6, 2019

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

3reactions
fo-focommented, Mar 24, 2019

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>
);
Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native style opacity for parent and child - Stack Overflow
Try changing the opacity using alpha-value of the background color instead. Then it should be possible applying different opacities for ...
Read more >
Customize React Native text color and other theme elements
Starting simply with a black-and-white layout · Adding one more color to your theme · Applying a triadic color scheme to our React...
Read more >
Color Reference - React Native
Components in React Native are styled using JavaScript. Color properties usually match how CSS works on the web. General guides on the color...
Read more >
react native webview background color - You.com | The AI ...
Yes. You can. You can actually change the background color of the webview by doing this. Add a style prop in the WebView...
Read more >
CSS font-size-adjust property - W3Schools
By specifying the font-size-adjust property, the browser will adjust the font ... same regardless of the font family ("verdana" has the aspect value...
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