Open
Description
Hello there!
Wanted to share an example setup file for projects that currently use react-with-styles
as this would result to error:
Example setup.js:
import globalCache from 'global-cache';
import ThemedStyleSheet from 'react-with-styles/lib/ThemedStyleSheet';
import aphroditeInterface from 'react-with-styles-interface-aphrodite';
import ReactDatesDefaultTheme from 'react-dates/lib/theme/DefaultTheme';
import YourCurrentTheme from './path/to/your/current/theme';
globalCache.setIfMissingThenGet('withStyles', () => {
/*
* Registering the default theme more than once clobbers all of the
* previously created styles, which causes errors to happen. This can happen
* if this file appears in more than one bundle on the same page. To avoid
* this, we are using a global cache.
*/
ThemedStyleSheet.registerTheme({
...YourCurrentTheme,
...ReactDatesDefaultTheme,
});
ThemedStyleSheet.registerInterface(aphroditeInterface);
return ThemedStyleSheet;
});
Metadata
Metadata
Assignees
Labels
Instructions and explanations for stuff!Instructions and explanations for stuff!