You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`remoteErrorView` | Replace the default error if a remote website's content could not be fetched | `function` | Optional
87
87
`emSize` | The default value in pixels for `1em` | `number` | `14`
88
88
`ptSize` | The default value in pixels for `1pt` | `number` | `1.3`
89
-
`baseFontStyle` | The default style applied to `<Text>` components | `number` | `14`
89
+
`baseFontStyle` | The default style applied to `<Text>` components | `object` | `{ fontSize: 14 }`
90
90
`textSelectable` | Allow all texts to be selected | `boolean` | `false`
91
91
`alterData` | Target some specific texts and change their content, see [altering content](#altering-content) | `function` | Optional
92
92
`alterChildren` | Target some specific nested children and change them, see [altering content](#altering-content) | `function` | Optional
@@ -158,7 +158,7 @@ renderers: {
158
158
159
159
The default renderer of the `<ul>` and `<ol>` tags will either render a bullet or the count of your elements. If you wish to change this without having to re-write the whole list rendering implementation, you can use the `listsPrefixesRenderers` prop.
160
160
161
-
Just like with the `renderers` prop, supply an object with `ul` and/or `ul` as functions that recevie the [same arguments as your custom HTML tags](#custom-html-tags). For instance, you can swap the default black bullet of `<ul>` with a blue cross :
161
+
Just like with the `renderers` prop, supply an object with `ul` and/or `ul` as functions that receive the [same arguments as your custom HTML tags](#custom-html-tags). For instance, you can swap the default black bullet of `<ul>` with a blue cross :
In addition to your custom renderers, you can apply specific styles to HTML tags (`tagsStyles`) or HTML classes (`classesStyles`). You can also combine these styles with your custom renderers.
175
175
176
-
Styling options override thesmelves, so you might render a custom HTML tag with a [custom renderer](#creating-custom-renderers) like `<bluecircle>`, make it green with a class `<bluecircle class="make-me-green">` or make it red by styling the tag itself.
176
+
Styling options override themselves, so you might render a custom HTML tag with a [custom renderer](#creating-custom-renderers) like `<bluecircle>`, make it green with a class `<bluecircle class="make-me-green">` or make it red by styling the tag itself.
177
177
178
178
The default style of your custom renderer will be merged to the one from your `classesStyles` which will also be merged by the `style` attribute.
179
179
180
180
> **IMPORTANT NOTE : Do NOT use the `StyleSheet` API to create the styles you're going to feed to `tagsStyle` and `classesStyles`. Although it might look like it's working at first, the caching logic of `react-native` makes it impossible for this module to deep check each of your style to properly apply the precedence and priorities of your nested tags' styles.**
181
181
182
-
Here's an usage example
182
+
Here's a usage example
183
183
184
184
```javascript
185
185
// props
@@ -195,25 +195,25 @@ const html = `
195
195
196
196
## Images
197
197
198
-
By default, unstyled images will be rendered with their respective height and width without resizing. You can force their dimensions by using the `style` attribute in your HTML content, or [style](#styling) them with a class or through the `<img>` tag.
198
+
By default, unstyled images will be rendered with their respective height and width without resizing. You can force their dimensions by using the `style` attribute in your HTML content or [style](#styling) them with a class or through the `<img>` tag.
199
199
200
200
If you can't set the dimension of each image in your content, you might find the `imagesMaxWidth` prop useful. It resizes (and keeps proportions) your images to a maximum width, ensuring that your images won't overflow out of your viewport.
201
201
202
-
A nice trick, demonstrated in the [basic usage of this module](#basic-usage) is to use the `Dimensions` API of react-native : `imagesMaxWidth={Dimensions.get('window').width}`. You could substract a value to it to make a margin.
202
+
A nice trick, demonstrated in the [basic usage of this module](#basic-usage) is to use the `Dimensions` API of react-native : `imagesMaxWidth={Dimensions.get('window').width}`. You could subtract a value to it to make a margin.
203
203
204
204
Please note that if you set width AND height through any mean of styling, `imagesMaxWidth` will be ignored.
205
205
206
206
Before their dimensions have been properly retrieved, images will temporarily be rendered in 100px wide squares. You can override this default value with prop `imagesInitialDimensions`.
207
207
208
208
Images with broken links will render an empty square with a thin border, similar to what safari renders in a webview.
209
209
210
-
Please note that all of these behaviours are implemented in the default `<img>` renderer. If you want to provide your own `<img>` renderer, you'll have to make this happen by yourself. You can use the `img` function in `HTMLRenderers.js` as a starting point.
210
+
Please note that all of these behaviors are implemented in the default `<img>` renderer. If you want to provide your own `<img>` renderer, you'll have to make this happen by yourself. You can use the `img` function in `HTMLRenderers.js` as a starting point.
211
211
212
212
## Altering content
213
213
214
214
`alterData` and `alterChildren` props are very useful to make some modifications on the structure of your HTML before it's actually rendered with react components.
215
215
216
-
They both are functions that receive the parsed `node` as their first and only parameter. You must return your changes: a `string` with `alterData` and an `array` with `alterChildren` or a falsy value if you don't need to change anything.
216
+
They both are functions that receive the parsed `node` as their first and only parameter. You must return your changes: a `string` with `alterData` and an `array` with `alterChildren` or a falsy value if you don't need to change anything.
217
217
218
218
### alterData
219
219
@@ -236,7 +236,7 @@ alterData: (node) => {
236
236
237
237
### alterChildren
238
238
239
-
`alterChildren` allows you to change the children wrapped in any node. For instance, you might want to change the content of a a list.
239
+
`alterChildren` allows you to change the children wrapped in any node. For instance, you might want to change the content of a list.
240
240
241
241
Here's an example :
242
242
@@ -303,7 +303,7 @@ You can't expect native components to be able to render *everything* you can fin
303
303
*`ignoredStyles` : array of ignored CSS rules. Nothing is ignored by default
304
304
*`ignoreNodesFunction` : this is a cumbersome, yet powerful, way of ignoring very specific stuff.
305
305
306
-
**Please note** that if you supply `ignoredTags`, you will override the default ignored ones. There are *a lot* of them, if you want to keep them and add you own, you can do something like :
306
+
**Please note** that if you supply `ignoredTags`, you will override the default ignored ones. There are *a lot* of them, if you want to keep them and add your own, you can do something like :
`ignoreNodesFunction` receives 3 parameters : `node`, `parentTagName` and `parentIsText`.
317
317
318
-
`node` is the result of the HTML parsing, which allows you to look for children, check the parent's markup and much more. `parentTagName` is a conveniant way to access the parent of your node, and `parentIsText` is a great way to make sure you won't be rendering a `<View>` inside a `<Text>` which, right now, makes react-native crash.
318
+
`node` is the result of the HTML parsing, which allows you to look for children, check the parent's markup and much more. `parentTagName` is a convenient way to access the parent of your node, and `parentIsText` is a great way to make sure you won't be rendering a `<View>` inside a `<Text>` which, right now, makes react-native crash.
0 commit comments