@@ -59,7 +59,7 @@ const ScrollableTabView = React.createClass({
59
59
currentPage : this . props . initialPage ,
60
60
scrollValue : new Animated . Value ( this . props . initialPage ) ,
61
61
containerWidth : Dimensions . get ( 'window' ) . width ,
62
- sceneKeys : this . updateSceneKeys ( this . props . children , [ ] , this . props . initialPage ) ,
62
+ sceneKeys : this . updateSceneKeys ( [ ] , this . props . initialPage ) ,
63
63
} ;
64
64
} ,
65
65
@@ -87,8 +87,8 @@ const ScrollableTabView = React.createClass({
87
87
}
88
88
}
89
89
90
- if ( this . props . children . length !== this . state . sceneKeys . length ) {
91
- let newKeys = this . updateSceneKeys ( this . props . children , this . state . sceneKeys , pageNumber ) ;
90
+ if ( this . _children ( ) . length !== this . state . sceneKeys . length ) {
91
+ let newKeys = this . updateSceneKeys ( this . state . sceneKeys , pageNumber ) ;
92
92
this . setState ( { currentPage : pageNumber , sceneKeys : newKeys , } ) ;
93
93
} else {
94
94
this . setState ( { currentPage : pageNumber , } ) ;
@@ -105,9 +105,9 @@ const ScrollableTabView = React.createClass({
105
105
}
106
106
} ,
107
107
108
- updateSceneKeys ( children , sceneKeys = [ ] , currentPage ) {
108
+ updateSceneKeys ( sceneKeys = [ ] , currentPage ) {
109
109
let newKeys = [ ] ;
110
- children . forEach ( ( child , idx ) => {
110
+ this . _children ( ) . forEach ( ( child , idx ) => {
111
111
let key = this . _makeSceneKey ( child , idx ) ;
112
112
if ( this . _keyExists ( sceneKeys , key ) || currentPage === idx ) {
113
113
newKeys . push ( key ) ;
@@ -202,8 +202,8 @@ const ScrollableTabView = React.createClass({
202
202
localCurrentPage = currentPage . nativeEvent . position ;
203
203
}
204
204
// scenekeys length and children length is same then no need to update the keys as all are stored by now
205
- if ( this . props . children . length !== this . state . sceneKeys . length ) {
206
- let newKeys = this . updateSceneKeys ( this . props . children , this . state . sceneKeys , localCurrentPage ) ;
205
+ if ( this . _children ( ) . length !== this . state . sceneKeys . length ) {
206
+ let newKeys = this . updateSceneKeys ( this . state . sceneKeys , localCurrentPage ) ;
207
207
this . setState ( { currentPage : localCurrentPage , sceneKeys : newKeys , } , ( ) => {
208
208
this . props . onChangeTab ( { i : localCurrentPage , ref : this . _children ( ) [ localCurrentPage ] , } ) ;
209
209
} ) ;
0 commit comments