Skip to content

Commit 7d11a2e

Browse files
committed
Fix dynamic styles update
1 parent 2910c24 commit 7d11a2e

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,19 @@ const createStyled = (jss?: Function = jssDefault) => (baseStyles: Object = {})
6363
}
6464

6565
if (dynamicStyles && !dynamicSheet.getRule(this.tagScoped)) {
66-
dynamicSheet.detach()
6766
dynamicSheet.addRule(this.tagScoped, dynamicStyles)
68-
dynamicSheet.update(this.tagScoped, this.props)
69-
dynamicSheet.attach()
67+
dynamicSheet
68+
.update(this.tagScoped, this.props)
69+
.deploy()
7070
}
7171
}
7272

7373
componentWillReceiveProps(nextProps: StyledElementPropsType) {
74-
if (dynamicStyles) dynamicSheet.update(this.tagScoped, nextProps)
74+
if (dynamicStyles) {
75+
dynamicSheet
76+
.update(this.tagScoped, nextProps)
77+
.deploy()
78+
}
7579
}
7680

7781
componentWillUnmount() {

0 commit comments

Comments
 (0)