Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions viewpager/indicator/PagerDotIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ export default class PagerDotIndicator extends Component {
initialPage: PropTypes.number,
pager: PropTypes.instanceOf(IndicatorViewPager),
dotStyle: View.propTypes.style,
selectedDotStyle: View.propTypes.style
selectedDotStyle: View.propTypes.style,
hideSingle: React.PropTypes.bool
}

static defaultProps = {
pageCount: 0,
initialPage: 0
initialPage: 0,
hideSingle: false
}

state = {
Expand All @@ -35,10 +37,11 @@ export default class PagerDotIndicator extends Component {
this.props.style != nextProps.style
}

render () {
let {pageCount, dotStyle, selectedDotStyle} = this.props
if (pageCount <= 0)return null
let dotsView = []
render() {
let {pageCount, dotStyle, selectedDotStyle}=this.props;
if (pageCount <= 0)return null;
if (this.props.hideSingle && pageCount == 1) return null;
let dotsView = [];
for (let i = 0; i < pageCount; i++) {
let isSelect = i === this.state.selectedIndex
dotsView.push(
Expand Down Expand Up @@ -79,4 +82,4 @@ const styles = StyleSheet.create({
selectDot: {
backgroundColor: 'white'
}
})
})