Browse Source

Improved HTML parsing

Arnaud Vergnet 3 years ago
parent
commit
b6915a1ebe
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      src/components/Overrides/CustomHTML.js

+ 11
- 1
src/components/Overrides/CustomHTML.js View File

@@ -21,15 +21,25 @@ class CustomHTML extends React.Component<Props> {
21 21
         return <Text {...passProps}>{children}</Text>;
22 22
     };
23 23
 
24
+    getListBullet = (htmlAttribs, children, convertedCSSStyles, passProps) => {
25
+        return (
26
+            <Text>- </Text>
27
+        );
28
+    };
29
+
24 30
     render() {
25 31
         // Surround description with p to allow text styling if the description is not html
26 32
         return <HTML
27 33
             html={"<p>" + this.props.html + "</p>"}
28 34
             renderers={{
29 35
                 p: this.getBasicText,
36
+                li: this.getBasicText,
30 37
             }}
38
+            listsPrefixesRenderers={{
39
+                ul: this.getListBullet
40
+            }}
41
+            ignoredTags={['img']}
31 42
             ignoredStyles={['color', 'background-color']}
32
-
33 43
             onLinkPress={this.openWebLink}/>;
34 44
     }
35 45
 }

Loading…
Cancel
Save