Skip to content

Commit

Permalink
Merge pull request #29756 from software-mansion-labs/ts-migration/Ren…
Browse files Browse the repository at this point in the history
…derHTML

[NO QA][TS migration] Migrate 'RenderHTML.js' component to TypeScript
  • Loading branch information
marcaaron authored Oct 31, 2023
2 parents 4339862 + 9235c56 commit 09a2000
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/components/RenderHTML.js → src/components/RenderHTML.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
import PropTypes from 'prop-types';
import React from 'react';
import {RenderHTMLSource} from 'react-native-render-html';
import useWindowDimensions from '@hooks/useWindowDimensions';

const propTypes = {
type RenderHTMLProps = {
/** HTML string to render */
html: PropTypes.string.isRequired,
html: string;
};

// We are using the explicit composite architecture for performance gains.
// Configuration for RenderHTML is handled in a top-level component providing
// context to RenderHTMLSource components. See https://git.io/JRcZb
// The provider is available at src/components/HTMLEngineProvider/
function RenderHTML(props) {
function RenderHTML({html}: RenderHTMLProps) {
const {windowWidth} = useWindowDimensions();
return (
<RenderHTMLSource
contentWidth={windowWidth * 0.8}
source={{html: props.html}}
source={{html}}
/>
);
}

RenderHTML.displayName = 'RenderHTML';
RenderHTML.propTypes = propTypes;
RenderHTML.defaultProps = {};

export default RenderHTML;

0 comments on commit 09a2000

Please sign in to comment.