It was narrated that An-Nu'man bin Bashir said:
The sun eclipsed during the time of the Messenger of Allah (ﷺ) and he rushed out, dragging his cloak until he came to the masjid. He continued leading us in prayer until the eclipse ended. When it ended, he said: 'People claim that the eclipse of the sun and moon only happen when a great man dies, but that is not so. Eclipses of the sun and the moon do not happen for the death or birth of anyone, but they are signs from Allah (SWT), the Mighty and Sublime. When Allah, the Mighty and Sublime, manifests Himself to anything of His creation, it humbles itself before Him, so if you see that then pray like the last obligatory prayer you did before that.'