Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setPage(index) {
if (index < 0) {
index = 0;
} else if (index >= this.state.pageCount) {
index = this.state.pageCount - 1;
}
this._scrolling = true;
Animated.spring(this.state.offsetLeft, {
toValue: index,
bounciness: 0,
restSpeedThreshold: 1
}).start(() => {
this._onPageScroll({
nativeEvent: {
position: index,
offset: 0
}
});
this._scrolling = false;
this.setState({
selectedPage: index
open(options = {}) {
this._emitStateChanged(SETTLING);
Animated.spring(this.state.openValue, {toValue: 1, bounciness: 0, restSpeedThreshold: 0.1, ...options}).start(() => {
this.props.onDrawerOpen && this.props.onDrawerOpen();
this._emitStateChanged(IDLE);
});
}
close(options = {}) {
this._emitStateChanged(SETTLING);
Animated.spring(this.state.openValue, {toValue: 0, bounciness: 0, restSpeedThreshold: 1, ...options}).start(() => {
this.props.onDrawerClose && this.props.onDrawerClose();
this._emitStateChanged(IDLE);
});
}