It can depend on the doctor, but most experienced GID specialists are able to work with any pre-existing mental health conditions you have. I know that it's a fear among many trans folk who have a pre-existing mental illness that they will be denied. In most cases, with a good, experienced doctor, you're not denied. My doctor put it this way: GID most often manifests when you're young 5-8 average, meanwhile most mental health issues don't show up until your teens, or even much later in life. Having GID all your life can also provoke mental heath issues.
Hey, I'm "crazy" and I'm now a year post-op. I'm doing great in the GID front, and not to bad with other mental health issues. I have issues from time to time, because surgery and transition don't cure everything, and you may still require treatment and therapy for a long time and perhaps your whole life. I think over all, taking care of my transition has helped my other issues.
I know a lot of trans folk who have existing mental disorders, and are able to go through transition fine. It's just about working with your doctors through the process.