diff --git a/src/components/Tabbar/CustomTabBar.tsx b/src/components/Tabbar/CustomTabBar.tsx index cd18b82..0f926d4 100644 --- a/src/components/Tabbar/CustomTabBar.tsx +++ b/src/components/Tabbar/CustomTabBar.tsx @@ -59,6 +59,8 @@ class CustomTabBar extends React.Component { this.state = { translateY: new Animated.Value(0), }; + // @ts-ignore + props.navigation.addListener('state', this.onRouteChange); } /** @@ -179,7 +181,7 @@ class CustomTabBar extends React.Component { 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 { render() { const {props, state} = this; - props.navigation.addListener('state', this.onRouteChange); const icons = this.getIcons(); return (