It is reported from the Prophet ﷺ that he once hurried out to the mosque when the sun had been eclipsed. He prayed until it became clear again, then said, "The people of the pre-Islamic era used to say that the sun and the moon are eclipsed only at the death of one of the great ones of the earth. But the sun and the moon are not eclipsed for the death of anyone, nor for his life. They are two of Allah's creations, and Allah brings about in His creation whatever He wills. So whichever of them is eclipsed, pray until it becomes clear or until Allah brings about some matter."
أخبرنا محمد بن بشار قال حدثنا معاذ بن هشام قال حدثني أبي عن قتادة عن الحسن
عن النبي ﷺ أنه خرج يوما مستعجلا إلى المسجد وقد انكسفت الشمس فصلى حتى انجلت ثم قال إن أهل الجاهلية كانوا يقولون إن الشمس والقمر لا ينخسفان إلا لموت عظيم من عظماء أهل الأرض وإن الشمس والقمر لا ينخسفان لموت أحد ولا لحياته ولكنهما خليقتان من خلقه يحدث الله في خلقه ما يشاء فأيهما انخسف فصلوا حتى ينجلي أو يحدث الله أمرا