I am assuming my XS Max is doing this randomly overnight. Only thing I can think of. I will wake up and sometimes I have to enter my passcode in to unlock the phone. This happens maybe once every 2 weeks randomly, I can't explain it. I'm on 12.1.1, my battery shows normal levels.
My old 6+, when that battery was failing it would do random reboots, show various % of battery life ranging from 99%, then dropping to 19, 18% within ten min - then shut off. THAT was a battery problem, I took care of that. But this - on the Max, I dont know what this is?