@@ -39,22 +39,16 @@ react-native run-ios
3939import React , {Component , StyleSheet , View , Text } from ' react-native' ;
4040import {IndicatorViewPager , PagerTitleIndicator , PagerDotIndicator } from ' rn-viewpager' ;
4141
42-
4342export default class ViewPagerPage extends Component {
44- state = {
45- count: 0
46- };
47-
4843 render () {
49- console .log (' render:' + this .state .count );
5044 return (
5145 < View style= {{flex: 1 }}>
5246 < IndicatorViewPager
5347 style= {{height: 200 }}
5448 indicator= {this ._renderDotIndicator ()}
5549 >
5650 < View style= {{backgroundColor: ' cadetblue' }}>
57- < Text > { ' count ' + this . state . count } < / Text >
51+ < Text > page one < / Text >
5852 < / View>
5953 < View style= {{backgroundColor: ' cornflowerblue' }}>
6054 < Text > page two< / Text >
@@ -69,7 +63,7 @@ export default class ViewPagerPage extends Component {
6963 indicator= {this ._renderTitleIndicator ()}
7064 >
7165 < View style= {{backgroundColor: ' cadetblue' }}>
72- < Text > { ' count ' + this . state . count } < / Text >
66+ < Text > page one < / Text >
7367 < / View>
7468 < View style= {{backgroundColor: ' cornflowerblue' }}>
7569 < Text > page two< / Text >
@@ -84,7 +78,7 @@ export default class ViewPagerPage extends Component {
8478 indicator= {this ._renderTabIndicator ()}
8579 >
8680 < View style= {{backgroundColor: ' cadetblue' }}>
87- < Text > { ' count ' + this . state . count } < / Text >
81+ < Text > page one < / Text >
8882 < / View>
8983 < View style= {{backgroundColor: ' cornflowerblue' }}>
9084 < Text > page two< / Text >
@@ -98,44 +92,28 @@ export default class ViewPagerPage extends Component {
9892 }
9993
10094 _renderTitleIndicator () {
101- return (
102- < PagerTitleIndicator
103- titles= {[' one' , ' two' , ' three' ]}
104- / >
105- );
95+ return < PagerTitleIndicator titles= {[' one' , ' two' , ' three' ]} / > ;
10696 }
10797
10898 _renderDotIndicator () {
109- return (
110- < PagerDotIndicator
111- pageCount= {3 }
112- / >
113- );
99+ return < PagerDotIndicator pageCount= {3 } / > ;
114100 }
115101
116102 _renderTabIndicator () {
117- let tabs = [
118- {
103+ let tabs = [{
119104 text: ' Home' ,
120105 iconSource: require (' ../imgs/ic_tab_home_normal.png' ),
121106 selectedIconSource: require (' ../imgs/ic_tab_home_click.png' )
122- },
123- {
107+ },{
124108 text: ' Message' ,
125109 iconSource: require (' ../imgs/ic_tab_task_normal.png' ),
126110 selectedIconSource: require (' ../imgs/ic_tab_task_click.png' )
127- },
128- {
111+ },{
129112 text: ' Profile' ,
130113 iconSource: require (' ../imgs/ic_tab_my_normal.png' ),
131114 selectedIconSource: require (' ../imgs/ic_tab_my_click.png' )
132- }
133- ];
134- return (
135- < PagerTabIndicator
136- tabs= {tabs}
137- / >
138- );
115+ }];
116+ return < PagerTabIndicator tabs= {tabs} / > ;
139117 }
140118
141119}
0 commit comments