Skip to content

Commit af75947

Browse files
charpeniExilz
authored andcommitted
Update doc on baseFontStyle and fix some typos
1 parent ac7201c commit af75947

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Prop | Description | Type | Required/Default
8686
`remoteErrorView` | Replace the default error if a remote website's content could not be fetched | `function` | Optional
8787
`emSize` | The default value in pixels for `1em` | `number` | `14`
8888
`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 }`
9090
`textSelectable` | Allow all texts to be selected | `boolean` | `false`
9191
`alterData` | Target some specific texts and change their content, see [altering content](#altering-content) | `function` | Optional
9292
`alterChildren` | Target some specific nested children and change them, see [altering content](#altering-content) | `function` | Optional
@@ -158,7 +158,7 @@ renderers: {
158158

159159
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.
160160

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 :
162162

163163
```javascript
164164
// ... your props
@@ -173,13 +173,13 @@ ul: (htmlAttribs, children, convertedCSSStyles, passProps) => {
173173

174174
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.
175175

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.
177177

178178
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.
179179

180180
> **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.**
181181
182-
Here's an usage example
182+
Here's a usage example
183183

184184
```javascript
185185
// props
@@ -195,25 +195,25 @@ const html = `
195195

196196
## Images
197197

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.
199199

200200
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.
201201

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.
203203

204204
Please note that if you set width AND height through any mean of styling, `imagesMaxWidth` will be ignored.
205205

206206
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`.
207207

208208
Images with broken links will render an empty square with a thin border, similar to what safari renders in a webview.
209209

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.
211211

212212
## Altering content
213213

214214
`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.
215215

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.
217217

218218
### alterData
219219

@@ -236,7 +236,7 @@ alterData: (node) => {
236236

237237
### alterChildren
238238

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.
240240

241241
Here's an example :
242242

@@ -303,7 +303,7 @@ You can't expect native components to be able to render *everything* you can fin
303303
* `ignoredStyles` : array of ignored CSS rules. Nothing is ignored by default
304304
* `ignoreNodesFunction` : this is a cumbersome, yet powerful, way of ignoring very specific stuff.
305305

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 :
307307

308308
```javascript
309309
import { IGNORED_TAGS } from 'react-native-render-html/src/HTMLUtils';
@@ -315,7 +315,7 @@ ignoredTags={[ ...IGNORED_TAGS, 'tag1', 'tag2']}
315315

316316
`ignoreNodesFunction` receives 3 parameters : `node`, `parentTagName` and `parentIsText`.
317317

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.
319319

320320
## Useful functions
321321

0 commit comments

Comments
 (0)