Skip to content

Commit f458574

Browse files
committed
Prevent Warn StyledComponent Inject if no Provider
1 parent dd34fef commit f458574

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/models/StyledComponent.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ export default (ComponentStyle) => {
88
const componentStyle = new ComponentStyle(rules)
99

1010
const StyledComponent = {
11-
inject: ['$theme'],
11+
inject: {
12+
$theme: {
13+
default: function () {
14+
return () => ({ })
15+
}
16+
}
17+
},
1218
props: mergedProps,
1319
render: function (createElement) {
1420
const children = []
@@ -45,11 +51,8 @@ export default (ComponentStyle) => {
4551
return this.generateAndInjectStyles(componentProps)
4652
},
4753
theme () {
48-
return this.$theme
49-
? this.$theme()
50-
: {
51-
default: {}
52-
}
54+
console.log(this.$theme)
55+
return this.$theme()
5356
}
5457
},
5558
extend (extendedRules) {

0 commit comments

Comments
 (0)