@@ -10,7 +10,6 @@ const {
1010 ScrollView,
1111 Platform,
1212 StyleSheet,
13- ViewPagerAndroid,
1413 InteractionManager,
1514} = ReactNative ;
1615const TimerMixin = require ( 'react-timer-mixin' ) ;
@@ -19,10 +18,6 @@ const SceneComponent = require('./SceneComponent');
1918const DefaultTabBar = require ( './DefaultTabBar' ) ;
2019const ScrollableTabBar = require ( './ScrollableTabBar' ) ;
2120
22- const AnimatedViewPagerAndroid = Platform . OS === 'android' ?
23- Animated . createAnimatedComponent ( ViewPagerAndroid ) :
24- undefined ;
25-
2621const ScrollableTabView = createReactClass ( {
2722 mixins : [ TimerMixin , ] ,
2823 statics : {
@@ -127,19 +122,9 @@ const ScrollableTabView = createReactClass({
127122 } ,
128123
129124 goToPage ( pageNumber ) {
130- if ( Platform . OS === 'ios' ) {
131- const offset = pageNumber * this . state . containerWidth ;
132- if ( this . scrollView ) {
133- this . scrollView . getNode ( ) . scrollTo ( { x : offset , y : 0 , animated : ! this . props . scrollWithoutAnimation , } ) ;
134- }
135- } else {
136- if ( this . scrollView ) {
137- if ( this . props . scrollWithoutAnimation ) {
138- this . scrollView . getNode ( ) . setPageWithoutAnimation ( pageNumber ) ;
139- } else {
140- this . scrollView . getNode ( ) . setPage ( pageNumber ) ;
141- }
142- }
125+ const offset = pageNumber * this . state . containerWidth ;
126+ if ( this . scrollView ) {
127+ this . scrollView . getNode ( ) . scrollTo ( { x : offset , y : 0 , animated : ! this . props . scrollWithoutAnimation , } ) ;
143128 }
144129
145130 const currentPage = this . state . currentPage ;
@@ -216,58 +201,30 @@ const ScrollableTabView = createReactClass({
216201 } ,
217202
218203 renderScrollableContent ( ) {
219- if ( Platform . OS === 'ios' ) {
220- const scenes = this . _composeScenes ( ) ;
221- return < Animated . ScrollView
222- horizontal
223- pagingEnabled
224- automaticallyAdjustContentInsets = { false }
225- contentOffset = { { x : this . props . initialPage * this . state . containerWidth , } }
226- ref = { ( scrollView ) => { this . scrollView = scrollView ; } }
227- onScroll = { Animated . event (
228- [ { nativeEvent : { contentOffset : { x : this . state . scrollXIOS , } , } , } , ] ,
229- { useNativeDriver : true , listener : this . _onScroll , }
230- ) }
231- onMomentumScrollBegin = { this . _onMomentumScrollBeginAndEnd }
232- onMomentumScrollEnd = { this . _onMomentumScrollBeginAndEnd }
233- scrollEventThrottle = { 16 }
234- scrollsToTop = { false }
235- showsHorizontalScrollIndicator = { false }
236- scrollEnabled = { ! this . props . locked }
237- directionalLockEnabled
238- alwaysBounceVertical = { false }
239- keyboardDismissMode = "on-drag"
240- { ...this . props . contentProps }
241- >
242- { scenes }
243- </ Animated . ScrollView > ;
244- } else {
245- const scenes = this . _composeScenes ( ) ;
246- return < AnimatedViewPagerAndroid
247- key = { this . _children ( ) . length }
248- style = { styles . scrollableContentAndroid }
249- initialPage = { this . props . initialPage }
250- onPageSelected = { this . _updateSelectedPage }
251- keyboardDismissMode = "on-drag"
252- scrollEnabled = { ! this . props . locked }
253- onPageScroll = { Animated . event (
254- [ {
255- nativeEvent : {
256- position : this . state . positionAndroid ,
257- offset : this . state . offsetAndroid ,
258- } ,
259- } , ] ,
260- {
261- useNativeDriver : true ,
262- listener : this . _onScroll ,
263- } ,
264- ) }
265- ref = { ( scrollView ) => { this . scrollView = scrollView ; } }
266- { ...this . props . contentProps }
267- >
204+ const scenes = this . _composeScenes ( ) ;
205+ return < Animated . ScrollView
206+ horizontal
207+ pagingEnabled
208+ automaticallyAdjustContentInsets = { false }
209+ contentOffset = { { x : this . props . initialPage * this . state . containerWidth , } }
210+ ref = { ( scrollView ) => { this . scrollView = scrollView ; } }
211+ onScroll = { Animated . event (
212+ [ { nativeEvent : { contentOffset : { x : this . state . scrollXIOS , } , } , } , ] ,
213+ { useNativeDriver : true , listener : this . _onScroll , }
214+ ) }
215+ onMomentumScrollBegin = { this . _onMomentumScrollBeginAndEnd }
216+ onMomentumScrollEnd = { this . _onMomentumScrollBeginAndEnd }
217+ scrollEventThrottle = { 16 }
218+ scrollsToTop = { false }
219+ showsHorizontalScrollIndicator = { false }
220+ scrollEnabled = { ! this . props . locked }
221+ directionalLockEnabled
222+ alwaysBounceVertical = { false }
223+ keyboardDismissMode = "on-drag"
224+ { ...this . props . contentProps }
225+ >
268226 { scenes }
269- </ AnimatedViewPagerAndroid > ;
270- }
227+ </ Animated . ScrollView > ;
271228 } ,
272229
273230 _composeScenes ( ) {
0 commit comments