Hakeem bin Hizam reported,

I said, "Messenger of Allah, what do you think about acts of devotion I used to perform during the days of ignorance, such as giving charity, freeing slaves, and maintaining family ties. Is there any reward for me in them?"The Prophet ﷺ replied, "You have embraced Islam along with all the good you did before."

Bukhari 1436

Sahih

حدثنا عبد الله بن محمد حدثنا هشام حدثنا معمر عن الزهري عن عروة

عن حكيم بن حزام رضي الله عنه قال

قلت يا رسول الله أرأيت أشياء كنت أتحنث بها في الجاهلية من صدقة أو عتاقة وصلة رحم فهل فيها من أجر فقال النبي ﷺ أسلمت على ما سلف من خير

البخاري 1436صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Zakat
Chapter
One who gave charity during shirk then accepted Islam
Numbering
Darussalam 1436
Bukhari 1436