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

Copy pasting any value with spaces should remove spaces. #849

Closed
sgokhru opened this issue May 6, 2024 · 1 comment
Closed

Copy pasting any value with spaces should remove spaces. #849

sgokhru opened this issue May 6, 2024 · 1 comment

Comments

@sgokhru
Copy link

sgokhru commented May 6, 2024

I'm using the AsyncTypeahead component as a input field:

So the when a user copy paste some string which contain trailing space then I want to remove the space and update the AsyncTypeahead value.

I have tried few ways:

  1. I am storing the typeahead value by using state variable and using that value but updated value is not getting reflected.
  2. I am creating a ref and trying to update value by using inputRef.current.getInput().value = trimmedValue.

Both the ways are not working.

@sgokhru sgokhru added the bug label May 6, 2024
@ericgio ericgio removed the bug label May 27, 2024
@ericgio
Copy link
Owner

ericgio commented May 28, 2024

Hey @sgokhru, there isn't a clean way to set the string value of the input once the component has mounted. One workaround might be to force the component to re-mount using a different key and then set the defaultInputValue with the trimmed value. Hope that helps.

@ericgio ericgio closed this as completed May 28, 2024
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

2 participants