Added beforeTransition hook

Not sure After transition is needed, I just do some animation which is in sync with transition anyway.