Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration into React Native app #162

Open
gHashTag opened this issue Sep 21, 2021 · 1 comment
Open

Integration into React Native app #162

gHashTag opened this issue Sep 21, 2021 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@gHashTag
Copy link

It is not clear from the documentation how to add decorators to history. Tell me how to implement it correctly.

const ThemeContext = React.createContext({})

const DarkTheme = {
  dark: true,
  colors: {
    primary: '#FF06F4',
    background: '#1c1c1c',
    card: 'rgb(255, 255, 255)',
    text: '#FFFF',
    border: 'rgb(199, 199, 204)',
    notification: 'rgb(255, 69, 58)'
  }
}

const LightTheme = {
  dark: false,
  colors: {
    primary: '#FF06F4',
    background: '#FFF',
    card: 'rgb(255, 255, 255)',
    text: '#1c1c1c',
    border: 'rgb(199, 199, 204)',
    notification: 'rgb(255, 69, 58)'
  }
}


// create a component that uses the dark mode hook
function ThemeWrapper(props) {
  // render your custom theme provider
  console.log(`useDarkMode()`, useDarkMode())
  return (
    <ThemeContext.Provider value={useDarkMode() ? DarkTheme : LightTheme}>
      {props.children}
    </ThemeContext.Provider>
  );
}

storiesOf('Txt', module
  .addDecorator((renderStory) => <ThemeWrapper>{renderStory()}</ThemeWrapper>)
  

Simulator Screen Shot - iPhone 12 - 2021-09-21 at 18 23 04
)

@hipstersmoothie
Copy link
Owner

I personally don't use react native. But if somebody figures this out please submit a PR!

@hipstersmoothie hipstersmoothie added the help wanted Extra attention is needed label Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants