diff --git a/Carousel.js b/Carousel.js
index 2a57da4..da93e9e 100644
--- a/Carousel.js
+++ b/Carousel.js
@@ -30,6 +30,7 @@ var Carousel = React.createClass({
animate: true,
delay: 1000,
loop: true,
+ backgroundColor: 'transparent'
};
},
@@ -53,9 +54,14 @@ var Carousel = React.createClass({
}
},
+ syncCarouselLocation() {
+ var width = this.state.activePage * this.props.width;
+ this.refs.scrollView && this.refs.scrollView.scrollWithoutAnimationTo(0, width);
+ },
+
indicatorPressed(activePage){
this.setState({activePage});
- this.refs.scrollView.scrollTo({y:0, x:activePage * width});
+ this.refs.scrollView.scrollTo({y:0, x:activePage * this.props.width});
},
renderPageIndicator() {
@@ -72,9 +78,11 @@ var Carousel = React.createClass({
};
position.left = (this.props.width - position.width) / 2;
- for (var i = 0, l = this.props.children.length; i < l; i++) {
- style = i === this.state.activePage ? { color: this.props.indicatorColor } : { color: this.props.inactiveIndicatorColor };
- indicators.push(•);
+ if (this.props.children.length > 1) {
+ for (var i = 0, l = this.props.children.length; i < l; i++) {
+ style = i === this.state.activePage ? { color: this.props.indicatorColor } : { color: this.props.inactiveIndicatorColor };
+ indicators.push(•);
+ }
}
return (
@@ -123,7 +131,7 @@ var Carousel = React.createClass({
return (