The problem is, if the phone was locked with the app running, it will show current codes right after unlock to anyone watching over the shoulder, security cameras, TV crews etc.
There are multiple ways to avoid this, e.g.:
close app completely on screen lock (the behaviour I'd personally expect and accept);
implement #37 after unlock (would solve more general problem of exposing unneeded codes);
ask for user confirmation after unlock (inelegant but probably easier to understand for some).
The problem is, if the phone was locked with the app running, it will show current codes right after unlock to anyone watching over the shoulder, security cameras, TV crews etc.
There are multiple ways to avoid this, e.g.: