Created
July 16, 2018 15:14
-
-
Save stephencookdev/e67902ec29b3759d54884ff7a936868e to your computer and use it in GitHub Desktop.
`SwitchWithSlide` example - update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentDidUpdate(prevProps, prevState) { | |
const prevUniqId = prevProps.uniqKey || prevProps.children.type; | |
const uniqId = this.props.uniqKey || this.props.children.type; | |
if (prevUniqId !== uniqId) { | |
this.setState({ | |
childPosition: Slider.TO_LEFT, | |
curChild: this.props.children, | |
curUniqId: uniqId, | |
prevChild: prevProps.children, | |
prevUniqId, | |
animationCallback: this.swapChildren | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment