Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HTMLView TS definitions to support class components #338

Open
CostachescuCristinel opened this issue Nov 9, 2021 · 0 comments
Open

Comments

@CostachescuCristinel
Copy link

Currently, HTMLView's definitions specify the following props to accept function components only:
NodeComponent, RootComponent, TextComponent

However, the source code that uses these props, only uses destructuring assignment to extract these from the HTMLView's props, and then creates these components as JSX tags:

RootComponent:

<RootComponent

NodeComponent:
<NodeComponent

TextComponent:
listItemPrefix = (<TextComponent style={[defaultStyle, customStyle]}>

This approach is compatible for use with both functional and class components.
In fact, I am using class components for these, and there are no problems.

Except: the TS definitions will issue a warning about failed prop types:
Warning: Failed prop type: Invalid prop 'TextComponent' of type 'object' supplied to 'HtmlView', expected 'function'.

Can you please update the TS definitions to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant