Two answers:
The best way to deal with fear and mental blocks is to take a step back and spend more time on the basics leading up to the skill. Break it down into its components, see if you can figure out what component is scaring you, and focus on isolating that.
The best way to deal with regularly-ocurring full-blown panic attacks is to talk to your doctor, to see if there might be some underlying issues contributing. Fear is normal and healthy, but frequent panic attacks are not
I agree, and if this isn't just a gymnastics problem, but rather a life problem that manifests in gymnastics, I would suggest:
1) Talking to your regular doctor (probably not going to be helpful, as they're not trained for these things)
2) Locate a GOOD therapist, preferably one that deals in sports/performance psychology. Depending on where you live, there are almost always such people who are affiliated with university D1 athletic departments.
3) Do some talk/cognitive behavioral theory. See if that helps.
4) If not,
and this is a problem more generally, start thinking about anxiety/anti depression/ADHD meds. You would probably want to do at least an extended consult with a psychiatrist, even though a lot of GPs will prescribe based on an informal screening by a therapist. Many different neurodivergent situations can manifest as anxiety, so keep an open mind.