Custom Inspector, How to create textfield on button click?

Im trying to make is so when I click a button in my inspector, a text field appears. It seems like a really simple thing to do. But for some reason the text field doenst appear.

 public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
         if (GUILayout.Button("Create key", GUILayout.Width(100)))
        {
            some = EditorGUILayout.TextField(some);
         }
    }

This is what I am trying to get to work.
if I put the code above the button code it works.
Im new with working with custom inspectors, so any help is appriciated.

The OnIspectorGUI callback is essentially called every frame, thus you have to make sure everything you want to see all the time is also called everytime.
Additionally, the Button does not automatically serve as some kind of toggle. Currently, you press the button and the TextField line is called once. You have to save the state of having the button clicked once.

private bool _PressedButton;
public override void OnInspectorGUI()
{
	base.OnInspectorGUI();
	if (GUILayout.Button("Create key", GUILayout.Width(100)))
	{
		_PressedButton != _PressedButton;
	}

	if(_PressedButton)
	{
		some = EditorGUILayout.TextField(some);
	}
}

This should work, although untested. In this example you change the state of the private member _PressedButton every time you click the button. Once the variable is true, the code execution calls the TextField line.