Skip to content

Typing for HTMLViewNode on Typescript #340

@lethanhan97

Description

@lethanhan97

Hey guys, stumbled upon this issue.

When I'm trying to provide the renderNode prop to RNHTMLView using Typescript, an argument node with type HTMLViewNode was provided

The HTMLViewNode type indicate that node doesn't have a type name children. However, it turns out that node does have the children type

Could the type be updated so that children is declared in HTMLViewNode?

const renderNode = (node: HTMLViewNode) => {
    const nodeChildren = node.children // IDE will show error

    // more code
}

Type declaration on react-native-htmlview/index.d.ts

Screenshot 2022-01-20 at 10 59 39 AM

Package info:

  • react-native-htmlview: 0.16.0
  • @types/react-native-html-view: 0.12.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions