jss: insertionPoint option is not used for createStyleSheet function
Checked the code
createStyleSheet(styles: Object, options: StyleSheetFactoryOptions = {}): StyleSheet {
let index = options.index
if (typeof index !== 'number') {
index = sheets.index === 0 ? 0 : sheets.index + 1
}
const sheet = new StyleSheet(styles, {
...options,
jss: (this: Jss),
generateClassName: options.generateClassName || this.generateClassName,
insertionPoint: this.options.insertionPoint,
Renderer: this.options.Renderer,
index
})
this.plugins.onProcessSheet(sheet)
return sheet
}
Even though you pass your insertionPoint in options it will be overwritten by default setting…
Found it while using new material ui beta release.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (12 by maintainers)
Commits related to this issue
- Added .idea directory to gitignore refs #547 — committed to darkowic/jss by deleted user 7 years ago
- createStyleSheet - allow to overwirte default StyleSheet options refs #547 — committed to darkowic/jss by deleted user 7 years ago
Ok, I configured
JssProviderand passed jss instance to it.and it is not working.
I console log the sheet from https://github.com/callemall/material-ui/blob/v1-beta/src/styles/withStyles.js#L140
Jss is set correctly. But still the
injectionPointoption set forStyleSheethas higher priority thenjssinstance. When I overwrite theinsertionPointfor sheetthen it works.
So, @kof looks like
createStyleSheetis broken because it will always setundefinedasinsertionPoint.