Currently, inputWidth is determined in the following way:
Before measureWrapper is called, it starts out as 400*
Once measureWrapper is called, this.state.inputWidth is set to the resultant this.wrapperWidth
On every onLayoutLastTag call, this.state.inputWidth gets updated to spaceLeft - 10, unless spaceLeft < 100, in which case it gets reset to this.wrapperWidth
* the TextInput width starts out as 400, but its container View starts out with an undefined width
My proposal:
this.state.inputWidth is a function of this.state.text, this.spaceLeft, and this.wrapperWidth
It gets updated whenever one of those inputs changes
It starts out as 90
It gets reset to 90** whenever this.state.text becomes the empty string
Otherwise, the logic is the same as the last bullet point in the existing behavior
** This is meant to be long enough to contain the placeholder. I noticed that without this safeguard, on some platforms (Android I think?) when a new tag is added a newline can temporarily appear and then disappear since the wrapperWidth is temporarily determined based on an out-of-date spaceLeft
Note that this PR is stacked on #37, and is diffed against that PR for easier readability.
Currently,
inputWidth
is determined in the following way:measureWrapper
is called, it starts out as 400*measureWrapper
is called,this.state.inputWidth
is set to the resultantthis.wrapperWidth
onLayoutLastTag
call,this.state.inputWidth
gets updated tospaceLeft - 10
, unlessspaceLeft < 100
, in which case it gets reset tothis.wrapperWidth
* the
TextInput
width starts out as 400, but its containerView
starts out with an undefinedwidth
My proposal:
this.state.inputWidth
is a function ofthis.state.text
,this.spaceLeft
, andthis.wrapperWidth
this.state.text
becomes the empty string** This is meant to be long enough to contain the placeholder. I noticed that without this safeguard, on some platforms (Android I think?) when a new tag is added a newline can temporarily appear and then disappear since the
wrapperWidth
is temporarily determined based on an out-of-datespaceLeft
Note that this PR is stacked on #37, and is diffed against that PR for easier readability.