From 868f84a632aa839fc296d5c27edc60efc3439604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Tue, 19 Jun 2018 08:46:34 +0800 Subject: [PATCH] delete some no no needrequestAnimationFrame --- src/components/Charts/Radar/index.js | 4 +--- src/components/Charts/WaterWave/index.js | 6 ++---- src/routes/Profile/AdvancedProfile.js | 24 +++++++++++------------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/components/Charts/Radar/index.js b/src/components/Charts/Radar/index.js index 64c51a65..a2e44ddb 100644 --- a/src/components/Charts/Radar/index.js +++ b/src/components/Charts/Radar/index.js @@ -12,9 +12,7 @@ export default class Radar extends Component { }; componentDidMount() { - requestAnimationFrame(() => { - this.getLegendData(); - }); + this.getLegendData(); } componentDidUpdate(preProps) { diff --git a/src/components/Charts/WaterWave/index.js b/src/components/Charts/WaterWave/index.js index ce4530c0..66f28adf 100644 --- a/src/components/Charts/WaterWave/index.js +++ b/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', () => { diff --git a/src/routes/Profile/AdvancedProfile.js b/src/routes/Profile/AdvancedProfile.js index 5289b677..8591d830 100644 --- a/src/routes/Profile/AdvancedProfile.js +++ b/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() { -- GitLab