diff --git a/Carousel.js b/Carousel.js index d1bca7a..0091876 100644 --- a/Carousel.js +++ b/Carousel.js @@ -29,7 +29,7 @@ var Carousel = React.createClass({ indicatorSpace: 25, animate: true, delay: 1000, - loop: true, + loop: true }; }, @@ -135,12 +135,17 @@ var Carousel = React.createClass({ }, render() { + let width = this.getWidth() + let style = { + flex: 1, + width: width + } + return ( - + diff --git a/CarouselPager.ios.js b/CarouselPager.ios.js index 8b1d95e..be63a98 100644 --- a/CarouselPager.ios.js +++ b/CarouselPager.ios.js @@ -1,6 +1,7 @@ var React = require('react'); var { ScrollView, + View } = require('react-native'); var CarouselPager = React.createClass({ @@ -29,9 +30,13 @@ var CarouselPager = React.createClass({ onMomentumScrollEnd={this._onMomentumScrollEnd} scrollsToTop={false} > - {this.props.children} + {React.Children.map(this.props.children, this.setWidth)} ; }, + + setWidth(child) { + return ({child}) + } }); module.exports = CarouselPager;