Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix The underline will flash as you swipe left and right #1142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ScrollableTabBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ const ScrollableTabBar = createReactClass({
}

},

prevPageOffset: 0,//解决 flash 闪屏问题
updateTabUnderline(position, pageOffset, tabCount) {
if(pageOffset==this.prevPageOffset) return
const lineLeft = this._tabsMeasurements[position].left;
const lineRight = this._tabsMeasurements[position].right;

Expand All @@ -122,6 +123,7 @@ const ScrollableTabBar = createReactClass({
this.state._leftTabUnderline.setValue(lineLeft);
this.state._widthTabUnderline.setValue(lineRight - lineLeft);
}
this.prevPageOffset = pageOffset
},

renderTab(name, page, isTabActive, onPressHandler, onLayoutHandler) {
Expand Down