forwardRef used in defaultStyle to pass ref in MentionInput component #477
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #411
What did you change (functionally and technically)?
As MentionInput is wrapped by defaultStyle wrapper ref was not getting set. So In defaultStyle file under utils directory, i have used forwardRef to pass my ref to MentionInput component so that anyone can use MentionInput ref in their parent component.
Use Case
Recently i had a requirement in which after writing some query if there is only 1 suggestion and user enters space then that mention should get selected. To achieve this i checked there is no way to send custom key props in the react mention and i don't want to write
selectFocused
function code which covers all the use cases. So i want to use it through ref but due to the issue mentioned in #411. I was not able to do itChecklist (remove this list before you submit the PR)
Additional review hints (remove this list before you submit the PR)