File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -67,14 +67,12 @@ const ScrollableTabView = React.createClass({
6767 } ,
6868
6969 componentDidMount ( ) {
70- const scrollFn = ( ) => {
71- if ( this . scrollView && Platform . OS === 'android' ) {
72- const x = this . props . initialPage * this . state . containerWidth ;
73- this . scrollView . scrollTo ( { x, animated : false } ) ;
74- }
75- } ;
7670 this . setTimeout ( ( ) => {
77- InteractionManager . runAfterInteractions ( scrollFn ) ;
71+ InteractionManager . runAfterInteractions ( ( ) => {
72+ if ( Platform . OS === 'android' ) {
73+ this . goToPage ( this . props . initialPage , false ) ;
74+ }
75+ } ) ;
7876 } , 0 ) ;
7977
8078 this . state . scrollX . addListener ( ( { value, } ) => {
@@ -94,10 +92,10 @@ const ScrollableTabView = React.createClass({
9492 }
9593 } ,
9694
97- goToPage ( pageNumber ) {
95+ goToPage ( pageNumber , animated = ! this . props . scrollWithoutAnimation ) {
9896 const offset = pageNumber * this . state . containerWidth ;
99- if ( this . scrollView ) {
100- this . scrollView . scrollTo ( { x : offset , y : 0 , animated : ! this . props . scrollWithoutAnimation , } ) ;
97+ if ( this . scrollView && this . scrollView . _component && this . scrollView . _component . scrollTo ) {
98+ this . scrollView . _component . scrollTo ( { x : offset , y : 0 , animated, } ) ;
10199 }
102100
103101 const currentPage = this . state . currentPage ;
You can’t perform that action at this time.
0 commit comments