react-native-paper icon indicating copy to clipboard operation
react-native-paper copied to clipboard

Outline line overlaps label

Open GrandLineAR opened this issue 3 years ago • 20 comments

Outline line overlaps label

https://user-images.githubusercontent.com/43339997/225590146-615965a0-96f6-41da-b9fb-922dc893ea4c.MP4

Screenshot at Mar 16 14-29-07

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

GrandLineAR avatar Mar 16 '23 10:03 GrandLineAR

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.

github-actions[bot] avatar Mar 16 '23 10:03 github-actions[bot]

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

lukewalczak avatar Mar 16 '23 18:03 lukewalczak

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

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

jeremyfalldev avatar Mar 31 '23 19:03 jeremyfalldev

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

Thanks, will take a look into it.

lukewalczak avatar Apr 01 '23 10:04 lukewalczak

@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

GrandLineAR avatar Apr 08 '23 17:04 GrandLineAR

ok, how is there a way to fix this?

wavewavewavewave avatar Jun 15 '23 10:06 wavewavewavewave

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.

lukewalczak avatar Jun 21 '23 16:06 lukewalczak

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 } }} /> );

Martijncvv avatar Jun 22 '23 19:06 Martijncvv

This can be fixed on the web though with fieldset

RichardLindhout avatar Jun 23 '23 11:06 RichardLindhout

See an old PR for that: https://github.com/callstack/react-native-paper/pull/883 Material UI uses the fieldset trick too :)

RichardLindhout avatar Jun 23 '23 11:06 RichardLindhout

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.

Martijncvv avatar Jun 23 '23 15:06 Martijncvv

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

RichardLindhout avatar Jun 29 '23 22:06 RichardLindhout

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

lelimit avatar Jul 12 '23 10:07 lelimit

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.

AbdurRobTanvir avatar Sep 11 '23 06:09 AbdurRobTanvir

I am still seeing this issue after the PR

robertcabrera4871 avatar Sep 13 '23 20:09 robertcabrera4871

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.

redbluenat avatar Oct 29 '23 23:10 redbluenat

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

ravithoria avatar Feb 17 '24 10:02 ravithoria

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.

JoshCarse avatar Jun 03 '24 07:06 JoshCarse

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

image

joannakasinska avatar Aug 19 '24 20:08 joannakasinska

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

t-fraczek avatar Oct 25 '24 10:10 t-fraczek