File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
examples/FacebookTabsExample Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export default React.createClass({
1010 render ( ) {
1111 return < ScrollableTabView
1212 style = { { marginTop : 20 , } }
13- initialPage = { 0 }
13+ initialPage = { 2 }
1414 renderTabBar = { ( ) => < ScrollableTabBar /> }
1515 >
1616 < Text tabLabel = 'Tab #1' > My</ Text >
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const {
1111 ScrollView,
1212 StyleSheet,
1313 InteractionManager,
14+ Platform,
1415} = ReactNative ;
1516const TimerMixin = require ( 'react-timer-mixin' ) ;
1617
@@ -63,6 +64,15 @@ const ScrollableTabView = React.createClass({
6364 } ;
6465 } ,
6566
67+ componentDidMount ( ) {
68+ InteractionManager . runAfterInteractions ( ( ) => {
69+ if ( this . scrollView && Platform . OS === 'android' ) {
70+ const x = this . props . initialPage * this . state . containerWidth ;
71+ this . scrollView . scrollTo ( { x, animated : false } ) ;
72+ }
73+ } ) ;
74+ } ,
75+
6676 componentWillReceiveProps ( props ) {
6777 if ( props . children !== this . props . children ) {
6878 this . updateSceneKeys ( { page : this . state . currentPage , children : props . children , } ) ;
You can’t perform that action at this time.
0 commit comments