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

forwardRef used in defaultStyle to pass ref in MentionInput component #477

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gurpreet013
Copy link

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

@vercel
Copy link

vercel bot commented Apr 9, 2021

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

@alexandre-combemorel
Copy link

Any update on this PR ?

@atilafassina
Copy link
Contributor

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 😅

@gurpreet013
Copy link
Author

@atilafassina Any update on this?

@lspdv
Copy link

lspdv commented May 26, 2022

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

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

Successfully merging this pull request may close these issues.

Add forwardRef to defaultStyle
4 participants