NEED HELP! phone reboots when i use the keyboard!

hello, i just recently began having an annoying issue with this phone. one morning i woke up and saw a text message, i slid the phone open so that i could use the keyboard. after i began typing a few words, the phone unexpectedly rebooted. This was a brand new phone, worked fine with no problems. The problem isn't limited to text messages. texting, internet, youtube app, or any other program where i can use the keyboard, causes the phone to reboot. sometimes it happens instantly, other times it takes some time. i have already trouble shooted some options, changed sim cards, reformatted sd card, uninstalled apps, cleared the cache, and factory reseted the phone, and the problem is still happening. if anyone can help me on this i'd greatly appreciate it.