@@ -57,28 +57,24 @@ const ScrollableTabView = createReactClass({
57
57
getInitialState ( ) {
58
58
const containerWidth = Dimensions . get ( 'window' ) . width ;
59
59
let scrollValue ;
60
- let scrollXIOS ;
61
- let positionAndroid ;
62
- let offsetAndroid ;
60
+ let scrollX ;
63
61
64
- scrollXIOS = new Animated . Value ( this . props . initialPage * containerWidth ) ;
62
+ scrollX = new Animated . Value ( this . props . initialPage * containerWidth ) ;
65
63
const containerWidthAnimatedValue = new Animated . Value ( containerWidth ) ;
66
64
// Need to call __makeNative manually to avoid a native animated bug. See
67
65
// https://github.com/facebook/react-native/pull/14435
68
66
containerWidthAnimatedValue . __makeNative ( ) ;
69
- scrollValue = Animated . divide ( scrollXIOS , containerWidthAnimatedValue ) ;
67
+ scrollValue = Animated . divide ( scrollX , containerWidthAnimatedValue ) ;
70
68
71
69
const callListeners = this . _polyfillAnimatedValue ( scrollValue ) ;
72
- scrollXIOS . addListener (
70
+ scrollX . addListener (
73
71
( { value, } ) => callListeners ( value / this . state . containerWidth )
74
72
) ;
75
73
76
74
return {
77
75
currentPage : this . props . initialPage ,
78
76
scrollValue,
79
- scrollXIOS,
80
- positionAndroid,
81
- offsetAndroid,
77
+ scrollX,
82
78
containerWidth,
83
79
sceneKeys : this . newSceneKeys ( { currentPage : this . props . initialPage , } ) ,
84
80
} ;
@@ -95,7 +91,7 @@ const ScrollableTabView = createReactClass({
95
91
} ,
96
92
97
93
componentWillUnmount ( ) {
98
- this . state . scrollXIOS . removeAllListeners ( ) ;
94
+ this . state . scrollX . removeAllListeners ( ) ;
99
95
} ,
100
96
101
97
goToPage ( pageNumber ) {
@@ -186,7 +182,7 @@ const ScrollableTabView = createReactClass({
186
182
contentOffset = { { x : this . props . initialPage * this . state . containerWidth , } }
187
183
ref = { ( scrollView ) => { this . scrollView = scrollView ; } }
188
184
onScroll = { Animated . event (
189
- [ { nativeEvent : { contentOffset : { x : this . state . scrollXIOS , } , } , } , ] ,
185
+ [ { nativeEvent : { contentOffset : { x : this . state . scrollX , } , } , } , ] ,
190
186
{ useNativeDriver : true , listener : this . _onScroll , }
191
187
) }
192
188
onMomentumScrollBegin = { this . _onMomentumScrollBeginAndEnd }
@@ -266,7 +262,7 @@ const ScrollableTabView = createReactClass({
266
262
// Need to call __makeNative manually to avoid a native animated bug. See
267
263
// https://github.com/facebook/react-native/pull/14435
268
264
containerWidthAnimatedValue . __makeNative ( ) ;
269
- scrollValue = Animated . divide ( this . state . scrollXIOS , containerWidthAnimatedValue ) ;
265
+ scrollValue = Animated . divide ( this . state . scrollX , containerWidthAnimatedValue ) ;
270
266
this . setState ( { containerWidth : width , scrollValue, } ) ;
271
267
272
268
this . requestAnimationFrame ( ( ) => {
@@ -326,7 +322,4 @@ const styles = StyleSheet.create({
326
322
container : {
327
323
flex : 1 ,
328
324
} ,
329
- scrollableContentAndroid : {
330
- flex : 1 ,
331
- } ,
332
325
} ) ;
0 commit comments