vitalets / react-native-extended-stylesheet

Extended StyleSheets for React Native
MIT License
2.93k stars 132 forks source link

Lib not working on Storybook??? #76

Closed tuanluu-agilityio closed 6 years ago

tuanluu-agilityio commented 6 years ago

I got issues when using react-native-extended-stylesheet on storybook. Look like storybook can't using this lib, it's mean I have using lib on components, but when calling components on storybook stylesheet not working. When I change from EStylesheet to Stylesheet, it's working fine. Anyone here have same issue with me and how resolved that?

Version:

"react-native-extended-stylesheet": "^0.8.0",
"react-native": "0.51.0",
"@storybook/react-native": "^3.2.16",
tuanluu-agilityio commented 6 years ago

I found the problem on my issue. The storybook working independent with app, so we need import EStyleSheet.build to index file of Storybook.

Thanks all watching.

vitalets commented 6 years ago

Thanks for sharing the solution!

ArthurAssuncao commented 1 year ago

I found the problem on my issue. The storybook working independent with app, so we need import EStyleSheet.build to index file of Storybook.

Thanks all watching.

This solution works yet. Expo: 47.0.12 React-native: 0.70.5 Storybook: 6.5.16

My .storybook/preview.js is showed in below:

import EStyleSheet from 'react-native-extended-stylesheet';

EStyleSheet.build({
      $theme: 'light', // required variable for caching!
      $colorPrimary: '#fff'
});

export const parameters = {
  actions: { argTypesRegex: "^on[A-Z].*" },
  controls: {
    matchers: {
      color: /(background|color)$/i,
      date: /Date$/,
    },
  },
};