diff --git a/htmlToElement.js b/htmlToElement.js
index 5bcca40..f25bb2f 100644
--- a/htmlToElement.js
+++ b/htmlToElement.js
@@ -1,5 +1,5 @@
import React from 'react';
-import {StyleSheet, Text} from 'react-native';
+import {StyleSheet, Text, View} from 'react-native';
import htmlparser from 'htmlparser2-without-node-native';
import entities from 'entities';
@@ -11,7 +11,7 @@ const defaultOpts = {
bullet: '\u2022 ',
TextComponent: Text,
textComponentProps: null,
- NodeComponent: Text,
+ NodeComponent: View,
nodeComponentProps: null,
};
@@ -69,7 +69,7 @@ export default function htmlToElement(rawHtml, customOpts = {}, done) {
const {TextComponent} = opts;
- if (node.type === 'text') {
+ if (node.type === 'text' || !node.children) {
const defaultStyle = opts.textComponentProps ? opts.textComponentProps.style : null;
const customStyle = inheritedStyle(parent);
@@ -154,10 +154,10 @@ export default function htmlToElement(rawHtml, customOpts = {}, done) {
style={!node.parent ? styles[node.name] : null}
onLongPress={linkLongPressHandler}
>
- {linebreakBefore}
+ {linebreakBefore && {linebreakBefore}}
{listItemPrefix}
{domToElement(node.children, node)}
- {linebreakAfter}
+ {linebreakAfter && {linebreakAfter}}
);
}