react-navigation.github.io
react-navigation.github.io copied to clipboard
[Question]Adding animation to screens in bottom nav when route changed
I have managed to animate screen in react native when bottom nav changes route.
Here what I am doing I am using react-native-animatable import * as Animatable from 'react-native-animatable';
constructor(props: any) {
super(props)
this.state = {
dummyKey:4564654
};
}
componentDidMount(){
this.props.navigation.addListener('focus', (e: any) => {
if(e){
this.setState({dummyKey:Math.random()})
}
})
}
render(){
<Animatable.View key={this.state.dummyKey} animation={'bounceIn'} >
//View to animate when loaded
</Animatable.View>
}
is this the correct way?