Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
transition = (toState, fromState, transitionCallback, transitionDuration = 0) => {
if (this._unmounted) return
const classList = getClassList(this)
const transitionClassName = this.getTransitionClassName(toState)
const prevTransitionClassName = this.getTransitionClassName(fromState)
const baseTransitionClassName = this.props.transitionClassName
if (fromState && transitionDuration && this.transitionEnabled(toState)) {
classList.add(baseTransitionClassName)
} else {
classList.remove(baseTransitionClassName)
}
if (prevTransitionClassName) {
classList.remove(prevTransitionClassName)
}
if (transitionClassName) {
this.setState({ transitioning: false }, () => {
if (this._unmounted) return
const classList = getClassList(this)
Object.keys(STATES).forEach((state) => {
classList.remove(this.getTransitionClassName(state))
})
classList.remove(transitionClassName)
})
}