It's been doing this ever since the one ui 6 update. It'll just constantly restart itself.
I've put it in safe mode and it still does it. I've factory reset it and it still does it the only time it doesn't seem to do it is when I'm not connected to Wi-Fi or at least it'll take a while before...