Riya refers to doing things that are pleasing to God with the intention of seeking admiration from others. It makes us focus on people's appreciation of our virtuous acts, which means we give importance to them, and not to God the Most Benevolent.
Imam has undertaken very serious discussion in his famous book of “an exposition on Forty Hadith” in this regard as following:
Today my eyes and yours are closed, and we do not possess any divine vision. Our terrestrial eyes are unable to perceive, but when the hidden is revealed and the kingdom of heaven is manifested, the physical world vanishes and reality is disclosed; you will realize that you were not a believer in God, and your rational judgment was not congruous with your faith.
Unless the words,—there is no god except God— are inscribed on the tablet of the heart with the pen of reason, man is not a true believer in the Unity of God.
When this sacred and holy dictum is impressed on the heart, the domain of the heart turns by itself into the kingdom of God Almighty. Then only man does not see anyone else as efficient in the realm of truth; he does not expect any rank, any distinction or riches from anybody else; he does not seek for honor and fame with the help of others; and his heart does not become hypocritical and profane.
Therefore, if you see that riya’ is stealing into your heart, you should realize that your heart has not really surrendered itself to reason, and faith has not illuminated your heart yet; for you consider others to be your God and see them as efficient agents in the world, and you do not trust Him, the only God; it means that you have joined the company of hypocrites, polytheists and idolaters.
Imam further explained as following:
What I am going to mention here to you is expected to work effectively for curing this disease of the heart, your as well as others’. It shall be also according to the rational dictates as well as is in conformity with the truths of revelation and tradition of the Ma’sumin (the infallibles). It is as well verifiable on the basis of the teachings of the Quran and your and my reason.
God Almighty, by means of His all embracing power and might, which governs the whole universe and is immanent in the realms of all possible beings, takes under His control the hearts of all His servants, as no one is outside the range of His power and the domain of His domination; and no one should occupy the hearts of human beings without His permission and His creative Will; not even the person himself has any control over his own heart without the permission of God Almighty. This fact has been revealed implicitly and explicitly in the Quran as well as the traditions of the members of the Household (Ahl al-Bayt)of the Prophet (PBUH).