Skip to content

Shadow Issue with Colored React Native Elements in TextInput Label #4441

@IsmailParacha

Description

@IsmailParacha

Current behaviour

I'm using react-native-paper for TextInput components. When I pass React Native elements as the label and apply color to them, I see a shadow/replica of the elements behind them. However, if I don't apply any color, the elements display properly.

My requirement is to show an asterisk (*) in the field label, where the asterisk should be red and the label text should be black.

Preview

Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-06-21.at.18.26.15.mp4

code

import React, {useState} from 'react';
import {TextInput} from 'react-native-paper';
import {StyleSheet, View, Button, Text} from 'react-native';
const Home = () => {
const [surname, setSurname] = useState('');
   <View style={styles.container}>
      <TextInput
        label={
          <>
            <Text style={{fontSize: 20, color: 'red'}}>{'Surname'}</Text>
            <Text style={{fontSize: 20, color: 'red'}}> *</Text>
          </>
        }
        mode="outlined"
        onChangeText={text => {
          setSurname(text);
        }}
        value={surname}
        placeholder="Enter Surname"
        style={{width: '80%', height: 50}}
      />
      <TextInput
        label={
          <>
            <Text style={{fontSize: 20}}>{'Forename'}</Text>
            <Text style={{fontSize: 20}}> *</Text>
          </>
        }
        mode="outlined"
        onChangeText={text => {
          setSurname(text);
        }}
        value={surname}
        placeholder="Enter Forename"
        style={{width: '80%', height: 50}}
      />
 </View>
  );
};
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

export default Home;

Your Environment

software version
ios 17
android 11
react-native 0.73.4
react-native-paper ^5.12.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions