FYI, I most certainly and intimately familiar with clinical depression and anxiety. However, I am not convinced this was the cause of her withdrawal.
She withdrew after making a big mistake in her first exercise, the Vault. Right after withdrawing from competition, she was quoted as saying:
“Physically, I feel good, I’m in shape. Emotionally, that kind of varies on the time and moment. Coming to the Olympics and being head star isn’t an easy feat.”
“I feel like I’m also not having as much fun. This Olympic Games, I wanted it to be for myself, but I came in and I felt like I was still doing it for other people. It hurts my heart that doing what I love has been kind of taken away from me to please other people.”
My impression is that she quite due to a combination of anger, frustration and embarrassment. Leading up to the competition she had be promoting herself as the “G.O.A.T.” - Greatest Of All Time. She even had her own personal collection of leotards with the image of a goat imprinted on them. Her ego just couldn’t handle the failure.
Or maybe the pressure of competing at that level and having to maintain it for a year longer than she planned just got to her.