mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-24 00:58:20 +00:00
Set initialLayout in defaultProps on Android (#2843)
* Revert "Workaround nested TabNavigation swipe issue (#2733)" This reverts commit 7b88a475bc283ce01fc9b6d57d0c28f4b34879d0. * Set initialLayout in defaultProps on Android This reverts the previous PR (#2733) and takes into account #2385 In order to fix https://github.com/react-native-community/react-native-tab-view/issues/312 * Don't use window's dimensions
This commit is contained in:
parent
7b88a475bc
commit
701337024e
@ -20,7 +20,6 @@ export type TabViewConfig = {
|
||||
tabBarComponent?: ReactClass<*>,
|
||||
tabBarPosition?: 'top' | 'bottom',
|
||||
tabBarOptions?: {},
|
||||
initialLayout?: { width: number, height: number },
|
||||
swipeEnabled?: boolean,
|
||||
animationEnabled?: boolean,
|
||||
lazy?: boolean,
|
||||
@ -38,7 +37,6 @@ type Props = {
|
||||
tabBarComponent?: ReactClass<*>,
|
||||
tabBarPosition?: 'top' | 'bottom',
|
||||
tabBarOptions?: {},
|
||||
initialLayout?: { width: number, height: number },
|
||||
swipeEnabled?: boolean,
|
||||
animationEnabled?: boolean,
|
||||
lazy?: boolean,
|
||||
@ -56,7 +54,14 @@ type Props = {
|
||||
},
|
||||
};
|
||||
|
||||
class TabView extends PureComponent<void, Props, void> {
|
||||
class TabView extends PureComponent<$Shape<Props>, Props, void> {
|
||||
static defaultProps = {
|
||||
// fix for https://github.com/react-native-community/react-native-tab-view/issues/312
|
||||
initialLayout: Platform.select({
|
||||
android: { width: 1, height: 0 },
|
||||
}),
|
||||
};
|
||||
|
||||
props: Props;
|
||||
|
||||
_handlePageChanged = (index: number) => {
|
||||
@ -208,9 +213,6 @@ class TabView extends PureComponent<void, Props, void> {
|
||||
screenProps: this.props.screenProps,
|
||||
style: styles.container,
|
||||
};
|
||||
if (Platform.OS === 'android') {
|
||||
props.initialLayout = { width: 1, height: 0 };
|
||||
}
|
||||
|
||||
return <TabViewAnimated {...props} />;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user