-1

I download npm react-native-render-html and it is working but when a text start with . dot the text become under the dot not beside it he is the result :

. \n Hello . \n Hello

I want it to be .Hello

and the data comes from the backend

1 Answers1

0

use react-native-htmlview it's more customizable give you an example code.

    const renderNode = (node, index, siblings, parent, defaultRenderer) => {
        if (node.type !== 'text') {
          if (node.name == 'p' || node.name == 'span') {
            let specialStyle = node.attribs.style;
            if (specialStyle) {
              specialStyle = specialStyle.split(';');
              let newStyle = { marginBottom: 10 };
            }
          }
        }
             
           return (
               <Text key={index} style={newStyle}>
                  {defaultRenderer(node.children, parent)}
               </Text>
            );
    
     }

<HTMLView value={description} addLineBreaks={true} lineBreak={"\n"} stylesheet={styles} paragraphBreak={"\n"} renderNode={renderNode} />