All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad, sallallaahu 'alayhi wa sallam, is His slave and Messenger.
Smiling during prayer does not invalidate it, according to the majority of scholars. Ibn Qudamah stated in Al-Mughni: “Most scholars said that smiling during prayer does not invalidate it.”
However, smiling during prayer intentionally entails a lack of Khushoo’ (performing prayer in a tranquil and unhurried manner) and serenity whatever the reason for smiling is.
Allah knows best.