Hakim bin Hizam (may Allah be pleased with him) said: I said: What do you think about the deeds I used to do in the Days of Ignorance with the intention of righteousness, such as maintaining ties of kinship, freeing slaves and giving charity; will I receive a reward for them? The Messenger of Allah (peace and blessings be upon him) said to me: "You have embraced Islam along with the good deeds you did before."
Hadith Referenceالمعجم الكبير للطبراني / باب الحاء / 3075