@@ -21,14 +21,14 @@ const ScrollableTabBar = require('./ScrollableTabBar');
21
21
22
22
23
23
const ScrollableTabView = React . createClass ( {
24
- mixins : [ TimerMixin , ] ,
24
+ mixins : [ TimerMixin , ] ,
25
25
statics : {
26
26
DefaultTabBar,
27
27
ScrollableTabBar,
28
28
} ,
29
29
30
30
propTypes : {
31
- tabBarPosition : PropTypes . oneOf ( [ 'top' , 'bottom' , 'overlayTop' , 'overlayBottom' , ] ) ,
31
+ tabBarPosition : PropTypes . oneOf ( [ 'top' , 'bottom' , 'overlayTop' , 'overlayBottom' , ] ) ,
32
32
initialPage : PropTypes . number ,
33
33
page : PropTypes . number ,
34
34
onChangeTab : PropTypes . func ,
@@ -46,8 +46,8 @@ const ScrollableTabView = React.createClass({
46
46
tabBarPosition : 'top' ,
47
47
initialPage : 0 ,
48
48
page : - 1 ,
49
- onChangeTab : ( ) => { } ,
50
- onScroll : ( ) => { } ,
49
+ onChangeTab : ( ) => { } ,
50
+ onScroll : ( ) => { } ,
51
51
contentProps : { } ,
52
52
scrollWithoutAnimation : false ,
53
53
locked : false ,
@@ -65,7 +65,6 @@ const ScrollableTabView = React.createClass({
65
65
} ,
66
66
67
67
componentDidMount ( ) {
68
- //InteractionManager.runAfterInteractions(() => {
69
68
setTimeout ( ( ) => {
70
69
if ( this . scrollView && Platform . OS === 'android' ) {
71
70
console . log ( "Scrolling to " + this . props . initialPage + " with containerWidth " + this . state . containerWidth ) ;
@@ -88,7 +87,7 @@ const ScrollableTabView = React.createClass({
88
87
goToPage ( pageNumber ) {
89
88
const offset = pageNumber * this . state . containerWidth ;
90
89
if ( this . scrollView ) {
91
- this . scrollView . scrollTo ( { x : offset , y : 0 , animated : ! this . props . scrollWithoutAnimation , } ) ;
90
+ this . scrollView . scrollTo ( { x : offset , y : 0 , animated : ! this . props . scrollWithoutAnimation , } ) ;
92
91
}
93
92
94
93
const currentPage = this . state . currentPage ;
@@ -108,9 +107,9 @@ const ScrollableTabView = React.createClass({
108
107
}
109
108
} ,
110
109
111
- updateSceneKeys ( { page, children = this . props . children , callback = ( ) => { } , } ) {
110
+ updateSceneKeys ( { page, children = this . props . children , callback = ( ) => { } , } ) {
112
111
let newKeys = this . newSceneKeys ( { previousKeys : this . state . sceneKeys , currentPage : page , children, } ) ;
113
- this . setState ( { currentPage : page , sceneKeys : newKeys , } , callback ) ;
112
+ this . setState ( { currentPage : page , sceneKeys : newKeys , } , callback ) ;
114
113
} ,
115
114
116
115
newSceneKeys ( { previousKeys = [ ] , currentPage = 0 , children = this . props . children , } ) {
@@ -146,11 +145,11 @@ const ScrollableTabView = React.createClass({
146
145
pagingEnabled
147
146
automaticallyAdjustContentInsets = { false }
148
147
contentOffset = { { x : this . props . initialPage * this . state . containerWidth , } }
149
- ref = { ( scrollView ) => { this . scrollView = scrollView ; } }
148
+ ref = { ( scrollView ) => { this . scrollView = scrollView ; } }
150
149
onScroll = { ( e ) => {
151
150
const offsetX = e . nativeEvent . contentOffset . x ;
152
151
this . _updateScrollValue ( offsetX / this . state . containerWidth ) ;
153
- } }
152
+ } }
154
153
onMomentumScrollBegin = { this . _onMomentumScrollBeginAndEnd }
155
154
onMomentumScrollEnd = { this . _onMomentumScrollBeginAndEnd }
156
155
scrollEventThrottle = { 16 }
@@ -172,9 +171,9 @@ const ScrollableTabView = React.createClass({
172
171
return < SceneComponent
173
172
key = { child . key }
174
173
shouldUpdated = { this . _shouldRenderSceneKey ( idx , this . state . currentPage ) }
175
- style = { { width : this . state . containerWidth , } }
176
- >
177
- { this . _keyExists ( this . state . sceneKeys , key ) ? child : < View tabLabel = { child . props . tabLabel } /> }
174
+ style = { { width : this . state . containerWidth , } }
175
+ >
176
+ { this . _keyExists ( this . state . sceneKeys , key ) ? child : < View tabLabel = { child . props . tabLabel } /> }
178
177
</ SceneComponent > ;
179
178
} ) ;
180
179
} ,
@@ -262,7 +261,7 @@ const ScrollableTabView = React.createClass({
262
261
} ;
263
262
}
264
263
265
- return < View style = { [ styles . container , this . props . style , ] } onLayout = { this . _handleLayout } >
264
+ return < View style = { [ styles . container , this . props . style , ] } onLayout = { this . _handleLayout } >
266
265
{ this . props . tabBarPosition === 'top' && this . renderTabBar ( tabBarProps ) }
267
266
{ this . renderScrollableContent ( ) }
268
267
{ ( this . props . tabBarPosition === 'bottom' || overlayTabs ) && this . renderTabBar ( tabBarProps ) }
0 commit comments