iPhone 5 randomly shuts off and only works properly when plugged in
I have an iPhone 5 16 GB and a couple of days ago I replaced the battery Because before, the battery it had couldn’t hold a charge and you weren’t able to turn on the phone and today I replaced the screen and put everything back together. After installing the new battery I noticed that it randomly shuts off with plenty of battery life and reboots when it’s not connected to power but when it’s connected everything works as it should. Is there any way to fix this or is this a problem with the phone?