Browse Source

delete some no no needrequestAnimationFrame

pull/1685/head
陈帅 8 years ago
parent
commit
868f84a632
  1. 4
      src/components/Charts/Radar/index.js
  2. 6
      src/components/Charts/WaterWave/index.js
  3. 24
      src/routes/Profile/AdvancedProfile.js

4
src/components/Charts/Radar/index.js

@ -12,9 +12,7 @@ export default class Radar extends Component {
};
componentDidMount() {
requestAnimationFrame(() => {
this.getLegendData();
});
this.getLegendData();
}
componentDidUpdate(preProps) {

6
src/components/Charts/WaterWave/index.js

@ -13,10 +13,8 @@ export default class WaterWave extends PureComponent {
};
componentDidMount() {
requestAnimationFrame(() => {
this.renderChart();
this.resize();
});
this.renderChart();
this.resize();
window.addEventListener(
'resize',
() => {

24
src/routes/Profile/AdvancedProfile.js

@ -212,19 +212,17 @@ export default class AdvancedProfile extends Component {
@Bind()
@Debounce(200)
setStepDirection() {
requestAnimationFrame(() => {
const { stepDirection } = this.state;
const w = getWindowWidth();
if (stepDirection !== 'vertical' && w <= 576) {
this.setState({
stepDirection: 'vertical',
});
} else if (stepDirection !== 'horizontal' && w > 576) {
this.setState({
stepDirection: 'horizontal',
});
}
});
const { stepDirection } = this.state;
const w = getWindowWidth();
if (stepDirection !== 'vertical' && w <= 576) {
this.setState({
stepDirection: 'vertical',
});
} else if (stepDirection !== 'horizontal' && w > 576) {
this.setState({
stepDirection: 'horizontal',
});
}
}
render() {

Loading…
Cancel
Save