@@ -20,7 +20,6 @@ export type TabViewConfig = {
20
20
tabBarComponent ?: ReactClass < * > ,
21
21
tabBarPosition ?: 'top' | 'bottom' ,
22
22
tabBarOptions ?: { } ,
23
- initialLayout ?: { width : number , height : number } ,
24
23
swipeEnabled ?: boolean ,
25
24
animationEnabled ?: boolean ,
26
25
lazy ?: boolean ,
@@ -38,7 +37,6 @@ type Props = {
38
37
tabBarComponent ?: ReactClass < * > ,
39
38
tabBarPosition ?: 'top' | 'bottom' ,
40
39
tabBarOptions ?: { } ,
41
- initialLayout ?: { width : number , height : number } ,
42
40
swipeEnabled ?: boolean ,
43
41
animationEnabled ?: boolean ,
44
42
lazy ?: boolean ,
@@ -56,7 +54,14 @@ type Props = {
56
54
} ,
57
55
} ;
58
56
59
- class TabView extends PureComponent < void , Props , void > {
57
+ class TabView extends PureComponent < $Shape < Props > , Props , void > {
58
+ static defaultProps = {
59
+ // fix for https://github.com/react-native-community/react-native-tab-view/issues/312
60
+ initialLayout : Platform . select ( {
61
+ android : { width : 1 , height : 0 } ,
62
+ } ) ,
63
+ } ;
64
+
60
65
props : Props ;
61
66
62
67
_handlePageChanged = ( index : number ) => {
@@ -208,9 +213,6 @@ class TabView extends PureComponent<void, Props, void> {
208
213
screenProps : this . props . screenProps ,
209
214
style : styles . container ,
210
215
} ;
211
- if ( Platform . OS === 'android' ) {
212
- props . initialLayout = { width : 1 , height : 0 } ;
213
- }
214
216
215
217
return < TabViewAnimated { ...props } /> ;
216
218
}
0 commit comments