Skip to content

ForwardRef support for PasswordField, FieldGroup, & FieldGroupIconButton #832

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

Merged
merged 4 commits into from
Nov 22, 2021

Conversation

reesscot
Copy link
Contributor

@reesscot reesscot commented Nov 22, 2021

Description of changes:
This PR adds forward ref support for the PasswordField, FieldGroup, & FieldGroupIconButton primitives by wrapping them in React.forwardRef.

const CustomerComponent = () => {
  const ref = React.useRef(null);
  
  // Below returns INPUT because the ref is forwarded down to DOM element (PasswordField => TextField => Input => <input>)
  // ref.current.nodeName
  
  return (
    <PasswordField label="name" ref={ref} />
  );
};

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@changeset-bot
Copy link

changeset-bot bot commented Nov 22, 2021

🦋 Changeset detected

Latest commit: 727724b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/ui-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@reesscot reesscot temporarily deployed to ci November 22, 2021 20:26 Inactive
@reesscot reesscot temporarily deployed to ci November 22, 2021 20:26 Inactive
@reesscot reesscot temporarily deployed to ci November 22, 2021 20:26 Inactive
@reesscot reesscot temporarily deployed to ci November 22, 2021 20:43 Inactive
@reesscot reesscot enabled auto-merge (squash) November 22, 2021 21:05
@reesscot reesscot temporarily deployed to ci November 22, 2021 21:14 Inactive
@reesscot reesscot temporarily deployed to ci November 22, 2021 21:14 Inactive
@reesscot reesscot temporarily deployed to ci November 22, 2021 21:14 Inactive
@reesscot reesscot temporarily deployed to ci November 22, 2021 21:33 Inactive
@reesscot reesscot merged commit f81aa59 into main Nov 22, 2021
@reesscot reesscot deleted the forward-ref-passwordfield branch November 22, 2021 21:38
@github-actions github-actions bot mentioned this pull request Nov 22, 2021
thaddmt added a commit that referenced this pull request Apr 7, 2023
Sync amplify-ui to amplify-ui-staging
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

Successfully merging this pull request may close these issues.

2 participants