Skip to content

Commit

Permalink
Merge pull request #4 from archriss/dev
Browse files Browse the repository at this point in the history
v1.2.1
  • Loading branch information
Exilz authored Nov 10, 2016
2 parents 4888f4e + d9e7e00 commit c9a8bc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,13 @@ export default class Carousel extends Component {
}

const snapX = this._positions[index].start;
this.refs.scrollview.scrollTo({x: snapX, y: 0, animated});
this.props.onSnapToItem && fireCallback && this.props.onSnapToItem(index);

// Make sure the component hasn't been unmounted
if (this.refs.scrollview) {
this.refs.scrollview.scrollTo({x: snapX, y: 0, animated});
this.props.onSnapToItem && fireCallback && this.props.onSnapToItem(index);
}

}

render () {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-snap-carousel",
"version": "1.2.0",
"version": "1.2.1",
"description": "Simple carousel component with snapping effect on Android & iOS for React Native",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit c9a8bc6

Please sign in to comment.