diff --git a/AppIntro.js b/AppIntro.js index 52b42d9..7ba36e5 100644 --- a/AppIntro.js +++ b/AppIntro.js @@ -108,6 +108,7 @@ export default class AppIntro extends Component { constructor(props) { super(props); + this.isScrolling = false; this.styles = StyleSheet.create(assign({}, defaulStyles, props.customStyles)); this.state = { @@ -119,6 +120,12 @@ export default class AppIntro extends Component { } onNextBtnClick = (context) => { + if (this.isScrolling) { + return; + } + + this.isScrolling = true; + if (context.state.isScrolling || context.state.total < 2) return; const state = context.state; const diff = (context.props.loop ? 1 : 0) + 1 + context.state.index; @@ -137,6 +144,16 @@ export default class AppIntro extends Component { this.props.onNextBtnClick(context.state.index); } + onLayout (e) { + this.width = e.nativeEvent.layout.width; + } + + onScroll (e) { + if (0 === e.x % this.width) { + this.isScrolling = false; + } + } + setDoneBtnOpacity = (value) => { Animated.timing( this.state.doneFadeOpacity, @@ -337,7 +354,7 @@ export default class AppIntro extends Component { } return ( - + {androidPages} {pages}