Skip to content

Commit

Permalink
Merge pull request meliorence#318 from Ryabchikus/master
Browse files Browse the repository at this point in the history
Fix crashes with <iframe> tag
  • Loading branch information
Benoît Delmaire authored Dec 29, 2019
2 parents f776d37 + f73dc41 commit 405918d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ An iOS/Android pure javascript react-native component that renders your HTML int

`npm install react-native-render-html --save` or `yarn add react-native-render-html`

Then, you must install and link [react-native-webview](https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md) packet to you project

## Basic usage

```javascript
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"buffer": "^4.5.1",
"events": "^1.1.0",
"html-entities": "^1.2.0",
"htmlparser2": "^3.10.1",
"react-native-webview": "^5.6.0"
"htmlparser2": "^4.0.0"
},
"peerDependencies": {
"prop-types": ">=15.5.10",
"react": "*",
"react-native": "*"
"react-native": "*",
"react-native-webview": "*"
},
"devDependencies": {
"babel-eslint": "8.2.2",
Expand Down
6 changes: 3 additions & 3 deletions src/HTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
PREFORMATTED_TAGS
} from './HTMLUtils';
import { generateDefaultBlockStyles, generateDefaultTextStyles } from './HTMLDefaultStyles';
import htmlparser2 from 'htmlparser2';
import { DomHandler, Parser } from 'htmlparser2';
import * as HTMLRenderers from './HTMLRenderers';

export default class HTML extends PureComponent {
Expand Down Expand Up @@ -127,8 +127,8 @@ export default class HTML extends PureComponent {

parseDOM (dom, props = this.props) {
const { decodeEntities, debug, onParsed } = this.props;
const parser = new htmlparser2.Parser(
new htmlparser2.DomHandler((_err, dom) => {
const parser = new Parser(
new DomHandler((_err, dom) => {
let RNElements = this.mapDOMNodesTORNElements(dom, false, props);
if (onParsed) {
const alteredRNElements = onParsed(dom, RNElements);
Expand Down

0 comments on commit 405918d

Please sign in to comment.