Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

314
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!