Problems with styling of mui TextField while rendering strings representing numbers and booleans

I have a react component that traverses a js object and dynamically generates a form showing all members of the object. I am using js String() method to convert all members before rendering them. At render i use this code:
<TextField style={{ marginTop: '8px', marginRight: '8px', width: fieldLength}} size='small' variant='outlined' label={key} value={valueString} />
This works fine for elements that were strings from the beginning, but strings that are converted from numbers or booleans are rendered with what seems to be the size attribute set to ‘normal’. I assume this is due to mui internal handling.

Anyone knowing how to circumvent this?

I have tried to set the height explicitly in the style prop and in InputProps. Neither of these changes the behaviour for numbers and booeans, but both methods works for strings.