It is OK to leave your phone flashlight on all night and it won't damage the phone although there's not much need to leave the phone flashlight on all night if you're sleeping.
But if you want to have some light such as during a power outage then leaving the phone flashlight on all night won't harm anything.
If you leave your phone flashlight on all night while charging the flashlight on the phone will just stay on or in some cases the phone may shut the flashlight off on the phone.
Sometimes my phone flashlight will shut off after around 2 hours or so but sometimes it stays on until I shut it off.
If you leave the phone flashlight on without charging the phone then the battery in the phone will deplete.
The flashlight on the phone's LED light should last around 50,000 hours and at 8 hours of being on that means that the LED flashlight bulb should last around 17 years.
Also LED bulbs don't draw all that much power or current so it should not have much of an effect on the charging rate of the phone.
When I leave my phone flashlight on for a few hours it hardly depletes the battery.
Leaving the flashlight on the phone will not harm your phone either.
It is helpful to remember that using your flashlight constantly can drain its battery over time.
Although, LED lights are long-lasting and efficient.
And as long as your phone battery has a charge, you can keep your flashlight on for multiple hours.
Most smartphones use LED lights, and these are estimated to last anywhere between 20,000 to 50,000 hours before they die.
Assuming you never turn it off, this means a flashlight should be able to stay on for 2.28 to 5.71 years before it dies.
Chances are you won't leave the flashlight on at all times.
The current a phone flashlight uses is around 80 mA (milliamps) , so in theory, if a phone battery has a capacity of 4500 mAh (milliamp hours), the running time should be around 56 hours (4500/80).
You can safely charge your phone or devices overnight without having to worry about damaging their internals.
Modern electronics automatically stop pulling current once their batteries reach 100% charge.
However, charging your smartphone to full each time isn't ideal for battery longevity.