Skip to content

Commit 2634f5d

Browse files
committed
reproduce safari issue
1 parent 7a30782 commit 2634f5d

File tree

6 files changed

+60
-3
lines changed

6 files changed

+60
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# React CSS Modules Examples
22

3+
**Issue Fork!** Example code to reproduce an issue with Safari + react-css-modules < v3.7.0.
4+
5+
Updated components don't no receive their [local styles](doc/fail_in_safari.png) (however they do if [dev-tool are open](doc/works_with_devtools_open.png)).
6+
7+
---
8+
39
https://github.com/gajus/react-css-modules
410

511
## Setup

doc/fail_in_safari.png

89 KB
Loading

doc/works_with_devtools_open.png

152 KB
Loading

src/UsingDecorator/index.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,27 @@ import styles from './../table.css';
44

55
@CSSModules(styles)
66
export default class extends React.Component {
7+
8+
constructor(props) {
9+
10+
super(props);
11+
12+
this.state = {
13+
count: 0
14+
};
15+
16+
// force updates in the component to break safari
17+
setInterval(() => {
18+
this.setState({
19+
count: this.state.count + 1
20+
});
21+
})
22+
}
23+
724
render () {
825
return <div styleName='table'>
926
<div styleName='row'>
10-
<div styleName='cell'>A0</div>
27+
<div styleName='cell'>A0 {this.state.count}</div>
1128
<div styleName='cell'>B0</div>
1229
</div>
1330
</div>;

src/UsingStyleName/index.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,27 @@ import CSSModules from 'react-css-modules';
33
import styles from './../table.css';
44

55
class Table extends React.Component {
6+
7+
constructor(props) {
8+
9+
super(props);
10+
11+
this.state = {
12+
count: 0
13+
};
14+
15+
// force updates in the component to break safari
16+
setInterval(() => {
17+
this.setState({
18+
count: this.state.count + 1
19+
});
20+
})
21+
}
22+
623
render () {
724
return <div styleName='table'>
825
<div styleName='row'>
9-
<div styleName='cell'>A0</div>
26+
<div styleName='cell'>A0 {this.state.count}</div>
1027
<div styleName='cell'>B0</div>
1128
</div>
1229
</div>;

src/UsingStylesProperty/index.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,27 @@ import CSSModules from 'react-css-modules';
33
import styles from './../table.css';
44

55
class Table extends React.Component {
6+
7+
constructor(props) {
8+
9+
super(props);
10+
11+
this.state = {
12+
count: 0
13+
};
14+
15+
// force updates in the component to break safari
16+
setInterval(() => {
17+
this.setState({
18+
count: this.state.count + 1
19+
});
20+
})
21+
}
22+
623
render () {
724
return <div styleName='table'>
825
<div styleName='row'>
9-
<div styleName='cell'>A0</div>
26+
<div styleName='cell'>A0 {this.state.count}</div>
1027
<div styleName='cell'>B0</div>
1128
</div>
1229
</div>;

0 commit comments

Comments
 (0)