Skip to content

Commit 7ffd338

Browse files
author
soliury
committed
some refacor about scrolableTabs
1 parent 0b465e9 commit 7ffd338

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/components/ScrollableTabs.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ class ScrollableTabs extends Component {
9999

100100

101101
_onScroll(e) {
102-
if (!this._scrolling) return;
102+
const {contentSize={}} = e.nativeEvent;
103+
104+
// 一下一行代码为解决一个奇葩的bug
105+
if (contentSize.height === 0 && contentSize.width === 0) return;
106+
107+
103108
const {x} = e.nativeEvent.contentOffset;
104109
this._scrolling = true;
105110
this._animateScroll(x);

src/layouts/Home.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ class Home extends Component {
2323
const {actions, topic, ui} = this.props;
2424
const tab = Tabs.tabs[page];
2525
if (topic[tab] && ui[tab] && !ui[tab].flag) {
26-
setTimeout(()=> {
27-
!isScrolling() && actions.updateTopicsByTab(tab);
28-
}, 16);
26+
actions.updateTopicsByTab(tab);
2927
}
3028
}
3129

0 commit comments

Comments
 (0)