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

TextField - only use leadingAccessoryRef when needed (i.e. floatingPlaceholder={true}) #3197

Conversation

M-i-k-e-l
Copy link
Contributor

@M-i-k-e-l M-i-k-e-l commented Aug 5, 2024

Description

TextField - only use leadingAccessoryRef when needed (i.e. floatingPlaceholder={true})

If the user has a function component for leadingAccessory:

export const LeadingAccessory = () => {
  return <Text marginR-2>leading accessory</Text>;
};

They will get an error since we require a ref for the leadingAccessory and in a function component it needs to be forwarded.
One solution is to use React.forwardRef, however this can be avoided in cases where floatingPlaceholder={false} because that's the only reason to have the ref.

Changelog

TextField - only require leadingAccessory to have a ref when needed (i.e. floatingPlaceholder={true})

Additional info

Channel (Aug. 1st)

@ethanshar ethanshar merged commit e633dcd into master Aug 11, 2024
1 check passed
@ethanshar ethanshar deleted the fix/text-field-leading-accessory-ref-only-when-floating-placeholder-2 branch August 11, 2024 08:28
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