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

Uncaught TypeError: _prefix.replace is not a function #11942

Closed
2 tasks done
celinrayen opened this issue Jun 21, 2018 · 4 comments
Closed
2 tasks done

Uncaught TypeError: _prefix.replace is not a function #11942

celinrayen opened this issue Jun 21, 2018 · 4 comments
Labels
support: question Community support but can be turned into an improvement

Comments

@celinrayen
Copy link

  • This is a v1.x issue (v0.x is no longer maintained).
  • I have searched the issues of this repository and believe that this is not a duplicate.

The withStyles is not working when used with Snackbar.
I'm trying this with the below versions. withStyles works perfectly fine in another component which wraps the Button. But while using Snackbar i receive the below issue.

createGenerateClassName.js:75 Uncaught TypeError: _prefix.replace is not a function
    at createGenerateClassName.js:75
    at RuleList.add (RuleList.js:109)
    at new StyleSheet (StyleSheet.js:52)
    at Jss.createStyleSheet (Jss.js:123)
    at WithStyles.attach (withStyles.js:326)
    at new WithStyles (withStyles.js:193)
    at ReactCompositeComponent.js:294
    at measureLifeCyclePerf (ReactCompositeComponent.js:75)
    at ReactCompositeComponentWrapper._constructComponentWithoutOwner (ReactCompositeComponent.js:293)
    at ReactCompositeComponentWrapper._constructComponent (ReactCompositeComponent.js:279)

The same piece of code works fine if I return an empty object in the style. Am I missing anything?

Tech Version
Material-UI 1.0.0-beta.47
React 15.6.1
browser chrome (67.0.3396.87)
@oliviertassinari oliviertassinari added the status: waiting for author Issue with insufficient information label Jun 21, 2018
@oliviertassinari
Copy link
Member

@celinrayen Your issue has been closed because it does not conform to our issue requirements.
Please provide a full reproduction test case. This would help a lot 👷 .
A live example would be perfect. This codesandbox.io template may be a good starting point. Thank you!

@celinrayen
Copy link
Author

celinrayen commented Jun 21, 2018

@oliviertassinari https://codesandbox.io/s/y2lk2nl4l1 is the replicated code snippet.

@oliviertassinari
Copy link
Member

Thanks. The fix is as simple as:

-NotificationBar.displayName = NotificationBar;
+NotificationBar.displayName = 'NotificationBar';

I'm adding a warning in the core about it.

@oliviertassinari oliviertassinari added support: question Community support but can be turned into an improvement and removed status: waiting for author Issue with insufficient information labels Jun 21, 2018
@oliviertassinari oliviertassinari changed the title withStyles throws error when used with Snackbar createGenerateClassName.js:75 Uncaught TypeError: _prefix.replace is not a function Jun 21, 2018
@oliviertassinari oliviertassinari changed the title createGenerateClassName.js:75 Uncaught TypeError: _prefix.replace is not a function Uncaught TypeError: _prefix.replace is not a function Jun 21, 2018
@celinrayen
Copy link
Author

@oliviertassinari Thanks a lot! Thats my bad. It's time to revisit my ESLINT rules :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

2 participants