Home > OS >  How to make bold a particular word inside a div in react native
How to make bold a particular word inside a div in react native

Time:03-01

Hello i have the following code:

getDescription = () => {
    return(
        <div className="Description">{this.props.mytext   ': '   this.name} </div>
    )
}

Is there any way to bold only the following text contained in the variable this.props.mytext? I looked at the tags but it doesn't work in my case

CodePudding user response:

You can use <Text> as a container for your other text components. This is an example:

...
<Text>
  <Text>This is a sentence</Text>
  <Text style={{fontWeight: "bold"}}> with</Text>
  <Text> one word in bold</Text>
</Text>
...

CodePudding user response:

You can append <strong></strong> within the div tag and then append the text within. You can also add an inline style and set fontWeight to 1000

  • Related