React Native add bold or italics to single words in field

后端 未结 12 2591
攒了一身酷
攒了一身酷 2020-12-13 05:14

How do I make a single word in a Text field bold or italics? Kind of like this:

This is a sentence with one word in bold         


        
12条回答
  •  温柔的废话
    2020-12-13 05:50

    Use this react native library

    To install

    npm install react-native-htmlview --save

    Basic Usage

     import React from 'react';
     import HTMLView from 'react-native-htmlview';
    
      class App extends React.Component {
      render() {
       const htmlContent = 'This is a sentence with one word in bold';
    
      return (
           );
      }
    }
    

    Supports almost all html tags.

    For more advanced usage like

    1. Link handling
    2. Custom Element Rendering

    View this ReadMe

提交回复
热议问题