There is an endocrine organ in our brain called the pineal gland. Its main function is to produce a large amount of melatonin when people fall asleep at night. The secretion of melatonin can reduce the excitement of the brain, make the body's blood pressure drop, slow down the heart rate, make the heart breathe smoothly, and make every part of our body have a good rest, which is to prepare for the normal life the next day. One of the biggest characteristics of the pineal gland is that our melatonin will stop working as long as the eyeball sees light. The eyelids partially cover the light source, but you will still feel the light source when you turn on the light.
So if you are really afraid of the dark or not, experts suggest wearing an eye mask when you sleep at night, so that even if you turn on the light at night, it will not affect the secretion of melatonin.