Fix tab bar not animating in certain cases

This commit is contained in:
Arnaud Vergnet 2020-09-23 09:20:06 +02:00
parent eaf1c52af5
commit df8f1cab24

View file

@ -59,6 +59,8 @@ class CustomTabBar extends React.Component<PropsType, StateType> {
this.state = {
translateY: new Animated.Value(0),
};
// @ts-ignore
props.navigation.addListener('state', this.onRouteChange);
}
/**
@ -179,7 +181,7 @@ class CustomTabBar extends React.Component<PropsType, StateType> {
if (isFocused) {
const stackState = route.state;
const stackRoute =
stackState && stackState.index
stackState && stackState.index != null
? stackState.routes[stackState.index]
: null;
const params: {collapsible: Collapsible} | null | undefined = stackRoute
@ -196,7 +198,6 @@ class CustomTabBar extends React.Component<PropsType, StateType> {
render() {
const {props, state} = this;
props.navigation.addListener('state', this.onRouteChange);
const icons = this.getIcons();
return (
<Animated.View