Praise be to Allah.
Reviling religion constitutes apostasy from Islam and disbelief in Allah the Almighty.
Please see the answers to questions no. 42505 and 148427 .
If someone says, in a moment of anger, a phrase cursing [someone’s] religion, without completing the phrase, that does not come under the same ruling as one who reviles and curses religion. So he may seek Allah’s forgiveness and does not have to do anything further, but he should control his anger after that, lest it lead him to doom.
The difference between annulment of good deeds and annulment of the reward for good deeds is that if a deed is annulled, meaning that it is rendered invalid, that by necessity means that the reward is also annulled. As for annulment of the reward, it means that the person will not have the reward for his deeds, but it does not necessarily mean that the deed itself is rendered invalid. The deed may be sound and valid, but the individual is not rewarded for it, as a punishment for a sin that he committed. Al-Khateeb ash-Sharbeeni (may Allah have mercy on him) said:
If the reward for a deed is annulled, it does not necessarily mean that the deed itself is rendered invalid, based on the fact that prayer offered in a house that has been seized unlawfully is still valid, and does not have to be made up elsewhere, even though there will be no reward for it according to the majority of scholars. End quote from Mughni al-Muhtaaj (5/427).
A person may do a deed that is valid in and of itself, but there is no reward for him in it, hence he has discharged his duty by doing it, and he is not required repeat it.
The scholars of the Permanent Committee for Ifta’ said:
Muslim narrated in his Saheeh from the Prophet (blessings and peace of Allah be upon him) that he said: “Whoever goes to a fortune teller and asks him about something, no prayer will be accepted from him for forty days.” What that means, according to all the scholars, is that there will be no reward, not that his prayer is rendered unsound and invalid. Hence the drinker of alcohol and the runaway slave, and the one who goes to the fortuneteller and asks him about something, are not to be instructed to repeat their prayers. End quote from Fataawa al-Lajnah ad-Daa’imah (5/144).
So the one who visited a fortune teller and continues to pray has discharged his duty, therefore his deed is not rendered null and void, but he will have no reward for it for forty days, thus the reward for his deed is annulled.
Ibn Maajah (4002) narrated that Abu Hurayrah said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) saying: “Any woman who puts on perfume, then goes out to the mosque, no prayer will be accepted from her until she does ghusl.” Classed as saheeh by al-Albaani in Saheeh Ibn Maajah.
Al-Minnaawi (may Allah have mercy on him) said:
That is because there will be no reward for her prayer so long as she is wearing perfume, but her prayer is valid and there is no need for her to make it up, as she has discharged her duty. So what is meant when the hadith says that the prayer will not be accepted is that there will be no reward for, so as to scare her and deter her from doing that. End quote from Fayd al-Qadeer (3/155).
It says in Mir‘qaat al-Mafaateeh (4/56):
Saying that something is accepted is more specific in meaning than saying that it is valid; in other words, to suggest that something is not accepted does not necessarily mean that it is not valid and sound. The soundness of the deed is the reason why the person is deemed to have discharged his duty, and acceptance of the deed is the cause of being rewarded for it. End quote.
As-Sufayri (may Allah have mercy on him) said in Sharh al-Bukhaari (2/254):
In Islamic terminology, when a deed is accepted, it means that the doer has attained reward for it, but saying that something is not accepted does not necessarily mean that it is not sound and valid; rather the reward may be ruled out even though the deed is valid, based on the fact that the prayer of a runaway slave is valid, and the prayer of one who drinks alcohol is valid so long as he is not in a state of intoxication, during the time when there is still some alcohol in his body, and the same applies to prayer offered in a house that has been acquired unlawfully, according to the Shaafa‘is, but there is no reward for any of them.
The word accepted may also be used to mean that the deed was done in a sound manner, and in that sense, if it says that it is not accepted, it means that it is not valid or sound. End quote.
If the apostate repents, his previous deeds before his Islam will not be null and void. The scholars of the Permanent Committee for Ifta’ said:
If someone apostatizes from Islam then comes back to it, his previous righteous deeds during the time when he was Muslim do not become null and void, because Allah, may He be exalted, says (interpretation of the meaning): “And whoever of you reverts from his religion [to disbelief] and dies while he is a disbeliever - for those, their deeds have become worthless in this world and the Hereafter, and those are the companions of the Fire, they will abide therein eternally” [al-Baqarah 2:217]. Thus Allah, may He be glorified, stipulated that in order for deeds to be rendered null and void, the doer should die in a state of disbelief. End quote from Fataawa al-Lajnah ad-Daa’imah (2/201).
With regard to the view that his good deeds remain whilst the reward is lost, that is not correct.
And Allah knows best.