I heard 'Ubaid b. 'Umair say: It has been narrated to me by one whom I regard as truthful, (the narrator says: I can well guess that he meant 'A'isha) that the sun eclipsed during the lifetime of the Messenger of Allah ﷺ and he stood up (in prayer) for a rigorously long time. He then bowed and then stood up and then bowed and then stood up and then bowed, thus observing three ruku's in two rak'ahs and four prostrations. He then departed and the sun brightened. He pronounced" Allah is the Greatest" while bowing. He would then bow and say:" Allah listened to him who praised Him" while lifting up his head. He then stood up, and praised Allah and lauded Him, and then said: The sun and the moon do not eclipse on the death of anyone or on his birth. But both of them are among the signs of Allah with which Allah terrifies His servants. So when you see them under eclipse, remember Allah till they are brightened.
أَنَّ الشَّمْسَ انْكَسَفَتْ عَلَى عَهْدِ رَسُولِ اللَّهِ ﷺ فَقَامَ قِيَامًا شَدِيدًا يَقُومُ قَائِمًا ثُمَّ يَرْكَعُ ثُمَّ يَقُومُ ثُمَّ يَرْكَعُ ثُمَّ يَقُومُ ثُمَّ يَرْكَعُ رَكْعَتَيْنِ فِي ثَلاَثِ رَكَعَاتٍ وَأَرْبَعِ سَجَدَاتٍ فَانْصَرَفَ وَقَدْ تَجَلَّتِ الشَّمْسُ وَكَانَ إِذَا رَكَعَ قَالَ اللَّهُ أَكْبَرُ ثُمَّ يَرْكَعُ وَإِذَا رَفَعَ رَأْسَهُ قَالَ سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ فَقَامَ فَحَمِدَ اللَّهَ وَأَثْنَى عَلَيْهِ ثُمَّ قَالَ إِنَّ الشَّمْسَ وَالْقَمَرَ لاَ يَكْسِفَانِ لِمَوْتِ أَحَدٍ وَلاَ لِحَيَاتِهِ وَلَكِنَّهُمَا مِنْ آيَاتِ اللَّهِ يُخَوِّفُ اللَّهُ بِهِمَا عِبَادَهُ فَإِذَا رَأَيْتُمْ كُسُوفًا فَاذْكُرُوا اللَّهَ حَتَّى يَنْجَلِيَا