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

fix: supporting empty labels #3215

Merged
merged 2 commits into from
Jun 25, 2022
Merged

Conversation

VictorioMolina
Copy link
Contributor

Summary

When using the current TextInputFlat.js, I get the error:

Text strings must be rendered within a component.

which breaks my components tree.

This is how I am using the TextInput component:

<TextInput
  ref={textInputRef}
  label="" <---- Try with an empty label
  placeholder="Enter a description..."
  ...
/>

The problem is in the line 311 of the TextInputFlat.js module. If you just do the following:

{!isAndroid && multiline && Boolean(label) && (

the error disappears.

Test plan

Just pass an empty label to the TextInput component. Something which, in my opinion, should be accepted.

You can also check this little snack, where the current bug is reproduced.

@callstack-bot
Copy link

callstack-bot commented Jun 21, 2022

Hey @VictorioMolina, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@VictorioMolina
Copy link
Contributor Author

It might not be really useful to support empty labels BTW, but I consider this a bug. Also, notice that you can pass empty placeholders to the current version without getting errors.

@lukewalczak
Copy link
Member

Hey @VictorioMolina, does the bug exist on the version 4.12.1?

@VictorioMolina
Copy link
Contributor Author

@lukewalczak yes.

@lukewalczak lukewalczak changed the title fix: supporting empty labels. fix: supporting empty labels Jun 25, 2022
@lukewalczak lukewalczak merged commit 1102870 into callstack:main Jun 25, 2022
lukewalczak pushed a commit that referenced this pull request Jun 25, 2022
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.

3 participants