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
i didnt see the problem, can u provide your code?
i try with react-native-render-html, and the result hello is beside dot.
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} />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.