iPhone XS turning off after plugged in
I’ve bought an iPhone XS (used) one on December of 2023 from a 3rd party reseller and on the day I bought it I replaced my original battery for a new one.it almost 6 months and the phone worked fine.suddenly yesterday when I plugged it into the charger it shows charging while the screen is still one but after the screen locked itself and within 30 seconds phone fully dies and not even Turing on untill the charger unplugged.after unplugged it turned on by double tapping .I changed the brick and cable but the issue still exists.I plugged it into my laptop then it chargers like normal no any errors.any one know whats wrong with it.is it something with the replaced battery.it shows unknown part in the battery health
iPhone 8 Plus, iOS 16