When I woke up today, my iPhone 7 kept going to lock screen and randomly restarting. So first it went to black screen with spinning wheel and then to lock screen. This also stopped any active apps.
I found the solution to this iPhone 7 problem on reddit (link below). It turns out that this is caused by apps that send out notifications at regular time.
The solution is that you turn off all your notifications or just for apps that send regular notifications this way your phone will stop showing you lock screen randomly.
If you iphone keeps returning to lock screen, randomly goes to a black screen, respiring or keeps crashing – this is the video for you.
iPhone 7+ black screen to spinning wheel to lockscreen
Reddit post that saved my iphone 7: