airbnb/react-with-styles

TypeError: _ThemedStyleSheet2.default.registerDefaultTheme is not a function

rpelorosso opened this issue · 4 comments

Hi! I'm having trouble making react-with-styles work. I'm using the code from the 'How to Use' section, but I'm receiving the error.

TypeError: _ThemedStyleSheet2.default.registerDefaultTheme is not a function

in withStyles.js. This file has the following code:

import ThemedStyleSheet from 'react-with-styles/lib/ThemedStyleSheet';
import aphroditeInterface from 'react-with-styles-interface-aphrodite';

import { css, withStyles, ThemeProvider } from 'react-with-styles';

import MyDefaultTheme from './MyDefaultTheme';

ThemedStyleSheet.registerDefaultTheme(MyDefaultTheme);
ThemedStyleSheet.registerInterface(aphroditeInterface);

export { css, withStyles, ThemeProvider, ThemedStyleSheet };

What can be happening?

thank you!
Rodrigo

Where is ThemedStyleSheet being imported in that code?

@ljharb Sorry, I messed up when creating the post. The triple quotes that start the code portion were on the same line and preventing the import to show. I've updated the code.

I don't see registerDefaultTheme here - what version of react-with-styles are you using?

@ljharb You're right. registerDefaultTheme doesn't exist, but it works with registerTheme. Looks like I needed a 2nd pair of eyes. Thank you so much!