Switch text Resize from auto-width to auto-height

To create an authentic text messaging app I need texts to be able to be one line or two. also to create the text bubble I need the text layer to be a variable width. The problem i’m running into is that I effectively need to switch from auto-width to auto-height to force the text onto a second line at a certain point.

Anyone figured out a workaround for this?

Detecting the width and scaling it doesn’t work.