In all honesty I don't know. You have given squat about code.
- Not to mention that I do not know what event it is?
- What is the purpose of the first line of code?
- What happens to the view if it does not need to transition?
My advice is to try and use '(', ')', '{', '}' characters and 'tabs' to see what the scopes and statements/expressions are in your code. It helps yourself to use white spacing and delimiter characters in your code even if the syntax could work without.