meliorence / react-native-render-html

iOS/Android pure javascript react-native component that renders your HTML into 100% native views
https://meliorence.github.io/react-native-render-html/
BSD 2-Clause "Simplified" License
3.48k stars 589 forks source link

App is crashing when heading tags are used #595

Closed gs-alranjan closed 1 year ago

gs-alranjan commented 1 year ago

Decision Table

Good Faith Declaration

Description

When using heading tags (Eg. h1,h2, etc), the layout crashes with the following error as in Image

Other HTML tags (like p, a, etc) are working fine.

React Native Information

App was run on ios, android simulator and real devices as well

RNRH Version

"react-native-render-html": "^6.3.4"

"react": "16.13.1", "react-native": "0.63.4",

Tested Platforms

Reproduction Platforms

Minimal, Reproducible Example

import React from "react";
import { Dimensions } from "react-native";
import RenderHtml from "react-native-render-html";
import { SafeAreaView } from "react-native-safe-area-context";

const source = {
  html: `<h1> hello world </h1>`
};

export class HtmlComponent {
  public render() {
    return (
      <SafeAreaView>
        <RenderHtml source={source} contentWidth={ Dimensions.get("window").width}/>
      </SafeAreaView>
    );
  }
}

Additional Notes

No response

jsamr commented 1 year ago

Looks like a mismatch in domutils version; make sure the version range required by @native-html/transient-render-engine (^2.8.0) matches the resolved version in your project.

EDIT: erratum

gs-alranjan commented 1 year ago

Looks like a mismatch in domutils version; make sure the version range required by @native-html/transient-render-tree (^2.8.0) matches the resolved version in your project.

Since @native-html/transient-render-tree is deprecated , "@native-html/transient-render-engine" "11.2.3" is auto-resolved.

jsamr commented 1 year ago

@gs-alranjan You're correct, I meant @native-html/transient-render-engine.

gs-alranjan commented 1 year ago

@jsamr still, headings are causing issues to be rendered. Any alternate solution?

jsamr commented 1 year ago

@gs-alranjan

Looks like a mismatch in domutils version; make sure the version range required by @native-html/transient-render-engine (^2.8.0) matches the resolved version in your project.

This still holds true. Depending on your package manager, you can see which version(s) of a peculiar package are installed. yarn why domutils or npm why domutils. Happy to reopen if this really turns out to be a bug, but currently it does seem like a packager issue.