Skip to content

Instantly share code, notes, and snippets.

@bogoslavskiy
Created July 8, 2018 20:07
Show Gist options
  • Save bogoslavskiy/0cef3d9d0e195433213b7d3bdaf7e3e2 to your computer and use it in GitHub Desktop.
Save bogoslavskiy/0cef3d9d0e195433213b7d3bdaf7e3e2 to your computer and use it in GitHub Desktop.
_setStateBar(state) {
let toValue = state == 'full' ? this.maxActionAnimated : 0;
Animated.timing(this.actionAnimated, {
toValue: toValue,
duration: 250,
useNativeDriver: true,
}).start();
}
minimizeBar = () => {
if(Math.round(this.scrollY._value) == 0) { // Full
this.scrollToOffset(this.topPartHeight);
} else { // Clamped
this._setStateBar('normal');
}
};
expandBar = () => {
if(this.stateBarTypes.EXPANDED == this.stateBar) {
return;
}
if(Math.round(this.scrollY._value) == this.topPartHeight) { // Full
this.scrollToOffset(0);
} else { // Clamped
this._setStateBar('full');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment