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
         return <Text {...passProps}>{children}</Text>;
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
     render() {
30
     render() {
25
         // Surround description with p to allow text styling if the description is not html
31
         // Surround description with p to allow text styling if the description is not html
26
         return <HTML
32
         return <HTML
27
             html={"<p>" + this.props.html + "</p>"}
33
             html={"<p>" + this.props.html + "</p>"}
28
             renderers={{
34
             renderers={{
29
                 p: this.getBasicText,
35
                 p: this.getBasicText,
36
+                li: this.getBasicText,
30
             }}
37
             }}
38
+            listsPrefixesRenderers={{
39
+                ul: this.getListBullet
40
+            }}
41
+            ignoredTags={['img']}
31
             ignoredStyles={['color', 'background-color']}
42
             ignoredStyles={['color', 'background-color']}
32
-
33
             onLinkPress={this.openWebLink}/>;
43
             onLinkPress={this.openWebLink}/>;
34
     }
44
     }
35
 }
45
 }

Loading…
Cancel
Save