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

Outline line overlaps label #3759

Closed
GrandLineAR opened this issue Mar 16, 2023 · 20 comments · Fixed by #3980
Closed

Outline line overlaps label #3759

GrandLineAR opened this issue Mar 16, 2023 · 20 comments · Fixed by #3980
Assignees

Comments

@GrandLineAR
Copy link

GrandLineAR commented Mar 16, 2023

Outline line overlaps label

RPReplay_Final1678962666.MP4

Screenshot at Mar 16 14-29-07

"react-native-paper": "^5.4.1"

@github-actions
Copy link

Hey! Thanks for opening the issue. Can you provide a minimal repro which demonstrates the issue? Posting a snippet of your code in the issue is useful, but it's not usually straightforward to run. A repro will help us debug the issue faster. Please try to keep the repro as small as possible. The easiest way to provide a repro is on snack.expo.dev. If it's not possible to repro it on snack.expo.dev, then you can also provide the repro in a GitHub repository.

@lukewalczak
Copy link
Member

Hey @GrandLineAR, please provide the snack or attach the code snippet which allow us to reproduce the issue.

@jeremyfalldev
Copy link

@lukewalczak We see this issue when we use 'backgroundColor: transparent'.

<TextInput
  mode="outlined"
  label="Name"
  style={{ backgroundColor: 'transparent' }}
/>

@lukewalczak
Copy link
Member

@lukewalczak We see this issue when we use 'backgroundColor: transparent'.

Thanks, will take a look into it.

@GrandLineAR
Copy link
Author

@lukewalczak We see this issue when we use 'backgroundColor: transparent'.

<TextInput
  mode="outlined"
  label="Name"
  style={{ backgroundColor: 'transparent' }}
/>

Yes, thank you! That's my omission, the documentation mentions that

@wavewavewavewave
Copy link

ok, how is there a way to fix this?

@lukewalczak
Copy link
Member

I believe we have encountered a limitation of the outlined text input – it will not work well with the patchy background such as an image or gradient.

The issue arises when the input is focused, the label is lifted up to the outline, causing a break in the border. To achieve the desired design, there is rendered label background view, with the same background color as the input, used to cover the border at the point of the break:

<TextInput style={{backgroundColor: 'yellow'}}
image

Passing backgroundColor: 'transparent' into TextInput ends with a missing cover break in the border:

image

To achieve the desired "transparent effect" in the outlined text input, I believe the best approach is to set the input's background color to match the background color of the screen, however this method works seamlessly when the colors are uniform.

I'm going to create a Known issue section in the documentation where that limitation will be mentioned in TextInput component.

@Martijncvv
Copy link

Martijncvv commented Jun 22, 2023

I also noticed a slight overlap of the label.
image

const outlineStyle: ViewStyle = { borderRadius: styles.radius.large, };

return ( <TextInput mode="outlined" label={label} value={text} outlineStyle={outlineStyle} onChangeText={text => setText(text)} theme={{ colors: { primary: styles.Colors.grey.default, outline: styles.Colors.grey.default } }} /> );

@RichardLindhout
Copy link
Contributor

This can be fixed on the web though with fieldset

@RichardLindhout
Copy link
Contributor

RichardLindhout commented Jun 23, 2023

See an old PR for that: #883
Material UI uses the fieldset trick too :)

@Martijncvv
Copy link

Thanks a lot. Do you have an idea how to see the code? The "Files changed" tab of the PR leads to a dead link.

@RichardLindhout
Copy link
Contributor

Yeah @Martijncvv it only works on web so I don't think it's usable since it won't work on iOS/React Native

@lelimit
Copy link

lelimit commented Jul 12, 2023

It's still a problem in react-native-paper 5.9.1.
I got this problem when upgrading react native from 0.71.8 to 0.72.1

@AbdurRobTanvir
Copy link

AbdurRobTanvir commented Sep 11, 2023

Hi, I am also facing similar kind of issue for the outline line overlapping label when I am increasing the border Width of outline Style in Text Input. In my mobile devices this looks fine but whenever I am running on Tablet the following issue is occurring where a line is visible under the label.

Capture
above image is what Tablet is showing.

Capture11
above image is what mobile is showing.

image
This is the code for outline style.

@robertcabrera4871
Copy link

I am still seeing this issue after the PR

@redbluenat
Copy link

redbluenat commented Oct 29, 2023

The issue still exists in:
"react-native-paper": "5.11.1",

It is related to the custom label text component. For string, it works okay.

@ravithoria
Copy link

Still facing issue in: react-native-paper: 5.12.3

@JoshCarse
Copy link

Yeah still getting issue in: "react-native-paper": "5.12.3".
Only when using custom label component as @redbluenat mentioned.
Using string for label works fine but I need to use custom label component.

@joannakasinska
Copy link

joannakasinska commented Aug 19, 2024

I worked around it by adding backgroundColor: 'color' to the styles:
<RNPaperTextInput label='label' style={{backgroundColor: 'white' }}/>

image

@t-fraczek
Copy link

"react-native-paper": "5.12.3".
Zrzut ekranu 2024-10-25 o 12 15 52

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

Successfully merging a pull request may close this issue.