Skip to content

Commit

Permalink
optimized code
Browse files Browse the repository at this point in the history
  • Loading branch information
easyui committed Jan 23, 2018
1 parent 4582c0f commit d890efd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/EZSwiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default class EZSwiper extends Component<{}> {
componentDidMount() {
setTimeout(() => {
InteractionManager.runAfterInteractions(() => {
this.scrollView.scrollTo({ [this.ezswiper.scrollToDirection]: (this.ezswiper.side * this.scrollIndex), animated: false });
this.scrollView && this.scrollView.scrollTo({ [this.ezswiper.scrollToDirection]: (this.ezswiper.side * this.scrollIndex), animated: false });
this.updateAnimated(this.scrollIndex, this.scrollIndex)
this.autoPlay()
this.setState({ initialized: true });
Expand All @@ -151,7 +151,7 @@ export default class EZSwiper extends Component<{}> {
| -------------------------------------------------------
*/
scrollTo(index, animated = true) {
this.scrollView.scrollTo({ [this.ezswiper.scrollToDirection]: this.ezswiper.side * index, animated: animated });
this.scrollView && this.scrollView.scrollTo({ [this.ezswiper.scrollToDirection]: this.ezswiper.side * index, animated: animated });
}

/**
Expand Down

0 comments on commit d890efd

Please sign in to comment.