One needs to have corneal transplantation surgery if the cornea is terribly damaged. Once the cornea is damaged or diseased, it will straightly impair vision or even cause vision loss, this is why people need to have the corneal transplant to restore the vision. We know that cornea is very sensitive with full of nerve ends, no blood vessels. Corneal scratches or abrasion will make eye extremely sensitive, not to mention corneal transplant. During the surgery, surgeon will replace the diseased or damaged cornea with the one from a subscriber in entire or in part. You can imagine how sensitive eyes could be after this kind of surgery. I don't think there is any good way to prevent light sensitivity before you are completely healed up. The best choice is to instill eye drops prescribed by your doctor, and wear dark sunglasses when you need to face any sunrays or glare. Without proper and good protection, it is possible to leave corneal scar which might require another surgery.
There may be many side effects after taking the corneal transplant, including the light sensitivity. You could use some eye drops with anti-inflammation to make the eyes look bright and clear. You should often practice going out and see in the sun. If you are not adapted to it, you could just wear the sunglasses. You should protect the eyes carefully with good rest. Then you will find the light sensitivity to light will disappear.