Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not update when input element is hidden on first render #178

Open
phiresky opened this issue Dec 9, 2020 · 0 comments
Open

Does not update when input element is hidden on first render #178

phiresky opened this issue Dec 9, 2020 · 0 comments

Comments

@phiresky
Copy link

phiresky commented Dec 9, 2020

When the input element is hidden on first render (e.g. a parent element has display: none set), then the computed size of the sizer element is "auto" instead of "123px", and the input does not notice when it gets shown, it is only updated after it is rerendered

Somewhat hacky, but this can be fixed by adding a resize observer watching the size of the input

	if (this.input.current)
		new ResizeObserver(() => this.updateInputWidth()).observe(
			this.input.current,
		)

to the componentDidMount function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant