|
@@ -78,19 +78,23 @@ class Info extends Component {
|
|
|
if (!this.main) {
|
|
if (!this.main) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- requestAnimationFrame(() => {
|
|
|
|
|
- let mode = 'inline';
|
|
|
|
|
- const { offsetWidth } = this.main;
|
|
|
|
|
- if (offsetWidth < 641 && offsetWidth > 400) {
|
|
|
|
|
- mode = 'horizontal';
|
|
|
|
|
- }
|
|
|
|
|
- if (window.innerWidth < 768 && offsetWidth > 400) {
|
|
|
|
|
- mode = 'horizontal';
|
|
|
|
|
- }
|
|
|
|
|
- this.setState({
|
|
|
|
|
- mode,
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const { mode: currentMode } = this.state;
|
|
|
|
|
+
|
|
|
|
|
+ let mode = 'inline';
|
|
|
|
|
+ const { offsetWidth } = this.main;
|
|
|
|
|
+
|
|
|
|
|
+ if (offsetWidth > 400 && offsetWidth < 641) {
|
|
|
|
|
+ mode = 'horizontal';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (window.innerWidth < 768 && offsetWidth > 400) {
|
|
|
|
|
+ mode = 'horizontal';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (mode !== currentMode) {
|
|
|
|
|
+ requestAnimationFrame(() => this.setState({ mode }));
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|