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

Textinput's outline appears behind the label if Text component is passed to label #4114

Closed
martenjurgens opened this issue Oct 6, 2023 · 6 comments
Assignees
Labels

Comments

@martenjurgens
Copy link

martenjurgens commented Oct 6, 2023

Current behaviour

If Text component is passed to the label of a TextInput, the outline isn't hidden properly and appears behind the label.

Expected behaviour

Acts the same as if a string is passed to the label.

How to reproduce?

const [text, setText] = React.useState("");

<TextInput
   // label={"Last name"}
  label={<Text style={{ color: "black" }}>Last name</Text>}
  value={text}
  onChangeText={text => setText(text)}
   />

Preview

How it looks like when Text component is passed to label
image

How it looks like when string is passed to label
image

Your Environment

software version
android 13
react-native 0.72.5
react-native-paper 5.10.6
@Lev-Shapiro
Copy link
Contributor

I'll start working on this today soon, please assign this issue to me

@lukewalczak
Copy link
Member

Thanks @Lev-Shapiro!

@WanYingT
Copy link

WanYingT commented Nov 3, 2023

How do I remove the label background just like this?
Screenshot 2023-11-03 at 10 19 12 PM

@Lev-Shapiro
Copy link
Contributor

I just checked my code that was merged and it doesn't seem to have any problems with background labeling. Could you share why you decided to comment on this issue? Anyway, I'll be happy to fix this

@WanYingT
Copy link

WanYingT commented Nov 4, 2023

I found that passing RNP Text component to the label props will still have this problem occurred, while using RN Text component is totally fine. Also, the problem I mentioned happens when I add { borderRadius: 30 } to the TextInput component to make it close to design, label background seems to be overflow. I understand I can remove the white background by using colors: { background: 'transparent' }, but it will not leave a field for that. Is there any possible approach to fix?

@Lev-Shapiro
Copy link
Contributor

Yes, creating a new issue and giving code to reproduce the problem

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

No branches or pull requests

4 participants