Skip to content

Commit

Permalink
warn consumers if themed styles are misused (p3). fix #1005
Browse files Browse the repository at this point in the history
  • Loading branch information
iamstarkov committed Jan 31, 2019
1 parent e170e79 commit 8d0a5ec
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/react-jss/src/withStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@ const getStyles = <Theme: {}>(styles: Styles<Theme>, theme: Theme, displayName:
}
warning(
styles.length < 1,
`Warning: [JSS]: <${displayName} />'s styles function doesn't rely on a theme. We recommend to rewrite it to plain object.\nRead more: https://github.com/cssinjs/jss/blob/master/docs/react-jss.md#basic`
)
warning(
styles.length > 1,
`Warning: [JSS]: <${displayName} />'s styles function uses ${
styles.length
} arguments, but react-jss passes only theme as 1st and only argument. We recommend to rewrite it to take only one argument.\nRead more: https://github.com/cssinjs/jss/blob/master/docs/react-jss.md#theming`
`Warning: [JSS]: <${displayName} />'s styles function doesn't rely on a theme. We recommend to rewrite it to plain object. Read more: https://github.com/cssinjs/jss/blob/master/docs/react-jss.md#basic`
)

return styles(theme)
Expand Down

0 comments on commit 8d0a5ec

Please sign in to comment.