From 5d5d4eeac36f59099334e0f91365ecb1287c4fa0 Mon Sep 17 00:00:00 2001 From: Maxim Bunkov Date: Mon, 18 May 2015 22:40:29 +0500 Subject: [PATCH] Update Carousel.js Added new property `indicatorPosition` --- Carousel.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Carousel.js b/Carousel.js index df71ea4..00b4eec 100644 --- a/Carousel.js +++ b/Carousel.js @@ -17,6 +17,7 @@ var Carousel = React.createClass({ indicatorSize: 20, inactiveIndicatorColor: '#999999', indicatorAtBottom: true, + indicatorPosition:20, width: 375 }; }, @@ -58,9 +59,18 @@ var Carousel = React.createClass({ if (this.props.hideIndicators === true) { return null; } - + + var pageIndicatorStyles = StyleSheet.create({ + pageIndicatorTop: { + top: this.props.indicatorPosition + }, + pageIndicatorBottom: { + bottom: this.props.indicatorPosition + } + }); + var indicators = [], - indicatorStyle = this.props.indicatorAtBottom ? styles.pageIndicatorBottom : styles.pageIndicatorTop, + indicatorStyle = this.props.indicatorAtBottom ? pageIndicatorStyles.pageIndicatorBottom : pageIndicatorStyles.pageIndicatorTop, style, position; position = { @@ -108,12 +118,6 @@ var styles = StyleSheet.create({ justifyContent: 'space-around', alignItems: 'center', backgroundColor:'transparent' - }, - pageIndicatorTop: { - top: 20 - }, - pageIndicatorBottom: { - bottom:20 } });