Open gHashTag opened 2 years ago
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>)
)
I personally don't use react native. But if somebody figures this out please submit a PR!
It is not clear from the documentation how to add decorators to history. Tell me how to implement it correctly.