Fix tab bar not animating in certain cases
This commit is contained in:
parent
eaf1c52af5
commit
df8f1cab24
1 changed files with 3 additions and 2 deletions
|
@ -59,6 +59,8 @@ class CustomTabBar extends React.Component<PropsType, StateType> {
|
||||||
this.state = {
|
this.state = {
|
||||||
translateY: new Animated.Value(0),
|
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) {
|
if (isFocused) {
|
||||||
const stackState = route.state;
|
const stackState = route.state;
|
||||||
const stackRoute =
|
const stackRoute =
|
||||||
stackState && stackState.index
|
stackState && stackState.index != null
|
||||||
? stackState.routes[stackState.index]
|
? stackState.routes[stackState.index]
|
||||||
: null;
|
: null;
|
||||||
const params: {collapsible: Collapsible} | null | undefined = stackRoute
|
const params: {collapsible: Collapsible} | null | undefined = stackRoute
|
||||||
|
@ -196,7 +198,6 @@ class CustomTabBar extends React.Component<PropsType, StateType> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {props, state} = this;
|
const {props, state} = this;
|
||||||
props.navigation.addListener('state', this.onRouteChange);
|
|
||||||
const icons = this.getIcons();
|
const icons = this.getIcons();
|
||||||
return (
|
return (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
|
|
Loading…
Reference in a new issue