How would you check if a mobile keyboard is visible and then turn that into a bool?

I want to trigger an animation when i open the mobile keyboard. If i could just change a bool value depending on the keyboard state. Thanks!

if (TouchScreenKeyboard.visible == true)
{
keyboardActive = true;
}

        else
        {
            keyboardActive = false;
        }

        if (keyboardActive == true) 
        {
            animate.SetBool("isText", true);
        }
    
        else
        {
            animate.SetBool("isText", false);
        }

Got it working!