react-mentions icon indicating copy to clipboard operation
react-mentions copied to clipboard

forwardRef used in defaultStyle to pass ref in MentionInput component

Open gurpreet013 opened this issue 3 years ago • 5 comments

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 it

Checklist (remove this list before you submit the PR)

  • Are there tests for the new code?
  • No
  • Does the code comply to our code conventions?
  • Yes
  • Does the PR resolve the whole issue?
  • Yes

Additional review hints (remove this list before you submit the PR)

  • Besides the code review, what should the reviewer test?
  • Are there any edge cases?
  • No
  • Do you have any test files or test set-up?
  • No
  • Could your changes cause side effects elsewhere in the code base?
  • No

gurpreet013 avatar Apr 09 '21 22:04 gurpreet013

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/signavio/react-mentions/3o1fwEAEHh3f838yA6wyybinWV3X
✅ Preview: https://react-mentions-git-fork-gurpreet013-forwardref-signavio.vercel.app

vercel[bot] avatar Apr 09 '21 22:04 vercel[bot]

Any update on this PR ?

alexandre-combemorel avatar Dec 10 '21 15:12 alexandre-combemorel

Thank you for the PR, @gurpreet013

@alexandre-combemorel

The project has collected a few dust, but after a few changes in governance, I'm now reviewing/merging. Please, give me some little time more as I get a hold of issues and figure stuff out 😅

atilafassina avatar Jan 20 '22 12:01 atilafassina

@atilafassina Any update on this?

gurpreet013 avatar Apr 26 '22 19:04 gurpreet013

Hey 👋 I am +1 to look at this PR please. 🙏 Thank you :-)

lspdv avatar May 26 '22 05:05 lspdv