The Messenger of Allah ﷺ said: "What is the matter with people who lift their gaze to the sky when praying?" And he spoke sternly concerning that until he said: "They must stop that or they will certainly lose their eyesight." (Using translation from Nasāʾī 1193)
أَنَّ نَبِيَّ اللهِ ﷺ قَالَ مَا بَالُ أَقْوَامٍ يَرْفَعُونَ أَبْصَارَهُمْ إِلَى السَّمَاءِ فِي صَلَاتِهِمْ وَاشْتَدَّ قَوْلُهُ فِي ذَلِكَ حَتَّى قَالَ لَيَنْتَهُنَّ عَنْ ذَلِكَ أَوْ لَتُخْطَفَنَّ أَبْصَارُهُمْ