I’ve tried your code in the simulator and I do not see the bug. Here is what it looks like before switching tabs:

and after:

I think it’s probably an issue with your display driver.
I’ve tried your code in the simulator and I do not see the bug. Here is what it looks like before switching tabs:

and after:

I think it’s probably an issue with your display driver.