Is there a way to block new lines on unity tmp input field?

I need a way to block line creation on my tmp pro input field

This is what happens when I create new lines:

201496-ezgif-4-11eb6f3320.gif

For anyone who have the same problem I used this code to solve it!

public TMP_Text text;
    public GameObject mainInputField;
    public int lines;

    void TransformSingleLine()
    {
        mainInputField.GetComponent<TMP_InputField>().lineType = TMP_InputField.LineType.SingleLine;
    }

    void TransformMultiLine()
    {
        mainInputField.GetComponent<TMP_InputField>().lineType = TMP_InputField.LineType.MultiLineNewline;
    }

    // Update is called once per frame
    void Update()
    {
        lines = text.textInfo.lineCount;
        if (lines > 15)
        {
            TransformSingleLine();
        }
        else
        {
            TransformMultiLine();
        }
    }