Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

316
Visualizações
How To Set Background Color To Text In React Native

I am new to react native so please help me to figure this out. I want to set background color to the text but this is some kind of different design.

enter image description here

I have tried with this code:-

<View style={styles.titleWrapper}>
     <View style={styles.titleInner}></View>
     <Text style={styles.title}>Mobile Verification</Text>
</View>

const styles = StyleSheet.create({
   titleWrapper: {
        justifyContent: 'center',
        alignContent: 'center',
        alignItems: 'center',
        marginTop: '8%',
        flexDirection: 'row'
    },
    titleInner: {
        backgroundColor: COLORS.LIME_GREEN,
        width: '50%',
        height: 22,
        position: 'absolute',
        bottom: 0,
        left: '23%',
        borderRadius: 14,
        opacity: 0.5,
    },
   title: {
        color: COLORS.BLACK,
        fontWeight: 'bold',
        fontSize: 25,
        textAlign: 'center',
    },
})

I want to implement same thing for other screens as well. Here the width of background color will be differ by text to text. So if length of text is short then we need width according to the text.

Please guide me how to apply the styles in it. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

you add zIndex

    titleInner: {
        backgroundColor: COLORS.LIME_GREEN,
        width: '50%',
        height: 22,
        position: 'absolute',
        bottom: 0,
        left: '23%',
        borderRadius: 14,
        opacity: 0.5,
        zIndex: 1,
    },
   title: {
        color: COLORS.BLACK,
        fontWeight: 'bold',
        fontSize: 25,
        textAlign: 'center',
        zIndex: 2,
    },

and check again.

Demo

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda