mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-10 17:23:42 +08:00
Only animate transition when index changes
This commit is contained in:
@@ -12,9 +12,11 @@ const DEFAULT_TRANSITION = (
|
||||
class SwitchView extends React.Component {
|
||||
containerRef = React.createRef();
|
||||
|
||||
componentDidUpdate() {
|
||||
this.containerRef.current &&
|
||||
this.containerRef.current.animateNextTransition();
|
||||
componentDidUpdate(prevProps) {
|
||||
if (this.props.navigation.state.index !== prevProps.navigation.state.index) {
|
||||
this.containerRef.current &&
|
||||
this.containerRef.current.animateNextTransition();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-navigation-animated-switch",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"author": "",
|
||||
|
||||
Reference in New Issue
Block a user