File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -15,12 +15,14 @@ export default class PagerDotIndicator extends Component {
1515 initialPage : PropTypes . number ,
1616 pager : PropTypes . instanceOf ( IndicatorViewPager ) ,
1717 dotStyle : View . propTypes . style ,
18- selectedDotStyle : View . propTypes . style
18+ selectedDotStyle : View . propTypes . style ,
19+ hideSingle : React . PropTypes . bool
1920 }
2021
2122 static defaultProps = {
2223 pageCount : 0 ,
23- initialPage : 0
24+ initialPage : 0 ,
25+ hideSingle : false
2426 }
2527
2628 state = {
@@ -35,10 +37,11 @@ export default class PagerDotIndicator extends Component {
3537 this . props . style != nextProps . style
3638 }
3739
38- render ( ) {
39- let { pageCount, dotStyle, selectedDotStyle} = this . props
40- if ( pageCount <= 0 ) return null
41- let dotsView = [ ]
40+ render ( ) {
41+ let { pageCount, dotStyle, selectedDotStyle} = this . props ;
42+ if ( pageCount <= 0 ) return null ;
43+ if ( this . props . hideSingle && pageCount == 1 ) return null ;
44+ let dotsView = [ ] ;
4245 for ( let i = 0 ; i < pageCount ; i ++ ) {
4346 let isSelect = i === this . state . selectedIndex
4447 dotsView . push (
@@ -79,4 +82,4 @@ const styles = StyleSheet.create({
7982 selectDot : {
8083 backgroundColor : 'white'
8184 }
82- } )
85+ } )
You can’t perform that action at this time.
0 commit comments