If it was dropped in water, then you need to carefully inspect and decontaminate it if water did indeed get inside the housing. Unless you’re really lucky, the camera issue may only be the tip of the iceberg. Water damaged devices tend to have latent issues which will bite you when you least expect it. Make sure to get a good backup of the data if the water happened under your watch. If you bought this device as-is from someone else, then again, do a proper inspection and decontamination.
- Open your phone and remove the logic board (follow this guide)
- Inspect the logic board, especially around the connectors and look for corrosion.
- Inspect both sides of the board. Unfortunately, most of the board is covered in shields. That's usually where the damage is occurring.
- Put your board in a container with >90% isopropyl alcohol and let it sit for a while.
- Use a soft brush, like a toothbrush and lightly brush away any corrosion you see.
- Rinse in alcohol and repeat.
- Let it air dry for a day.
- Re-assemble and hope for the best.
Once this is done and the camera is the only remaining issue, you can replace it but check the camera connector on the logic board to see if there is any corrosion as there is usually corrosion there. Any physical damage to this connector will require a micro-soldering repair.