Skip to content

Instantly share code, notes, and snippets.

@bogoslavskiy
Created July 8, 2018 21:06
Show Gist options
  • Save bogoslavskiy/921144827c4bbdfec2e057a42fe456c3 to your computer and use it in GitHub Desktop.
Save bogoslavskiy/921144827c4bbdfec2e057a42fe456c3 to your computer and use it in GitHub Desktop.
_updateScroll = ({value, manually}) => {
if(value && manually) {
this._clampedScrollValue = value;
} else {
const diff = value - this._scrollValue;
this._scrollValue = Math.max(value, this.topPartHeight); // Fix normal state
this._clampedScrollValue = Math.min(
Math.max(this._clampedScrollValue + diff, this.minClamp),
this.maxClamp
);
}
this._changeStatusBarStyle();
this._changeStateBar();
};
onTabPress = (route) => {
let type = this.stateBarTypes;
let offset = (this.stateBar == type.NORMAL) ? this.topPartHeight :
(this.stateBar == type.CLAMPED) ? this.maxClamp : 0;
this.initialState.scrollToOffset({
offset: offset,
animated: false,
tab: route.key
});
this.scrollY.setValue(offset);
this._createClampedScroll();
this._updateScroll({value: offset, manually: true});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment