Facing issue in TextInput of react-native-paper ,The label is using line-through effect when I set its background as transparent. How to remove this line-through effect from the label text when the background color is set to transparent, when color is set as white its working fine ,but when I changed the color to transparent,issue arises.

Attached my style code and issue screenshot.

 inputStyleOutlined: {
   minHeight: moderateScale(38.4),
   color: COLORS.secondary,
   fontWeight: FONT_WEIGHT.fontWeight4,
   fontSize: moderateScale(FONT_SIZE.font_14),
   letterSpacing: moderateScale(0.2),
   width: "100%",
   backgroundColor: COLORS.transparent,
 }

enter image description here

3

There are 3 best solutions below

3
On
0
On

From what I've been able to tell, react-native-paper is not designed to handle that. It seems to use the background color to appear on top of the outlined border (where the label is at the top). If we set it to any level of transparency, we can see the border underneath. Your best bet is to pass in a backgroundColor prop and set the backgroundColor explicitly to match whatever background is surrounding it.

0
On

Instead of string, you can pass label like this and add your own styling to it,

<TextInput
  value={value}
  label={
    <Text style={Styles.labelStyle}>{label}</Text>}
  ...
/>