@@ -329,21 +329,23 @@ const ScrollableTabView = createReactClass({
329
329
_handleLayout ( e ) {
330
330
const { width, } = e . nativeEvent . layout ;
331
331
332
- if ( Math . round ( width ) !== Math . round ( this . state . containerWidth ) ) {
333
- if ( Platform . OS === 'ios' ) {
334
- const containerWidthAnimatedValue = new Animated . Value ( width ) ;
335
- // Need to call __makeNative manually to avoid a native animated bug. See
336
- // https://github.com/facebook/react-native/pull/14435
337
- containerWidthAnimatedValue . __makeNative ( ) ;
338
- scrollValue = Animated . divide ( this . state . scrollXIOS , containerWidthAnimatedValue ) ;
339
- this . setState ( { containerWidth : width , scrollValue, } ) ;
340
- } else {
341
- this . setState ( { containerWidth : width , } ) ;
342
- }
343
- this . requestAnimationFrame ( ( ) => {
344
- this . goToPage ( this . state . currentPage ) ;
345
- } ) ;
332
+ if ( ! width || width <= 0 || Math . round ( width ) === Math . round ( this . state . containerWidth ) ) {
333
+ return ;
334
+ }
335
+
336
+ if ( Platform . OS === 'ios' ) {
337
+ const containerWidthAnimatedValue = new Animated . Value ( width ) ;
338
+ // Need to call __makeNative manually to avoid a native animated bug. See
339
+ // https://github.com/facebook/react-native/pull/14435
340
+ containerWidthAnimatedValue . __makeNative ( ) ;
341
+ scrollValue = Animated . divide ( this . state . scrollXIOS , containerWidthAnimatedValue ) ;
342
+ this . setState ( { containerWidth : width , scrollValue, } ) ;
343
+ } else {
344
+ this . setState ( { containerWidth : width , } ) ;
346
345
}
346
+ this . requestAnimationFrame ( ( ) => {
347
+ this . goToPage ( this . state . currentPage ) ;
348
+ } ) ;
347
349
} ,
348
350
349
351
_children ( children = this . props . children ) {
0 commit comments