diff --git a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx index a743783cf2f6..06b413a81dee 100755 --- a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx +++ b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx @@ -6,9 +6,9 @@ import convertToLTR from '@libs/convertToLTR'; import FontUtils from '@styles/utils/FontUtils'; import * as HTMLEngineUtils from './htmlEngineUtils'; import htmlRenderers from './HTMLRenderers'; -import type {HTMLEngineProviderProps} from './types'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; -type BaseHTMLEngineProviderProps = HTMLEngineProviderProps & { +type BaseHTMLEngineProviderProps = ChildrenProps & { /** Whether text elements should be selectable */ textSelectable?: boolean; diff --git a/src/components/HTMLEngineProvider/htmlEngineUtils.ts b/src/components/HTMLEngineProvider/htmlEngineUtils.ts index 8d188017e91e..5f082424a565 100644 --- a/src/components/HTMLEngineProvider/htmlEngineUtils.ts +++ b/src/components/HTMLEngineProvider/htmlEngineUtils.ts @@ -1,5 +1,6 @@ import type {TNode} from 'react-native-render-html'; -import type {Predicate} from './types'; + +type Predicate = (node: TNode) => boolean; const MAX_IMG_DIMENSIONS = 512; @@ -47,7 +48,7 @@ function isChildOfNode(tnode: TNode, predicate: Predicate): boolean { * Finding node with name 'comment' flags that we are rendering a comment. */ function isChildOfComment(tnode: TNode): boolean { - return isChildOfNode(tnode, (node) => node.domNode?.name !== undefined && isCommentTag(node.domNode?.name)); + return isChildOfNode(tnode, (node) => node.domNode?.name !== undefined && isCommentTag(node.domNode.name)); } /** @@ -55,7 +56,7 @@ function isChildOfComment(tnode: TNode): boolean { * Finding a node with the name 'h1' flags that we are rendering inside an h1 element. */ function isChildOfH1(tnode: TNode): boolean { - return isChildOfNode(tnode, (node) => node.domNode?.name !== null && node.domNode?.name.toLowerCase() === 'h1'); + return isChildOfNode(tnode, (node) => node.domNode?.name !== undefined && node.domNode.name.toLowerCase() === 'h1'); } export {computeEmbeddedMaxWidth, isChildOfComment, isCommentTag, isChildOfH1}; diff --git a/src/components/HTMLEngineProvider/index.native.tsx b/src/components/HTMLEngineProvider/index.native.tsx index bff138ced481..c77bcaf7c5e3 100755 --- a/src/components/HTMLEngineProvider/index.native.tsx +++ b/src/components/HTMLEngineProvider/index.native.tsx @@ -1,8 +1,8 @@ import React from 'react'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; import BaseHTMLEngineProvider from './BaseHTMLEngineProvider'; -import type {HTMLEngineProviderProps} from './types'; -function HTMLEngineProvider({children}: HTMLEngineProviderProps) { +function HTMLEngineProvider({children}: ChildrenProps) { return {children}; } diff --git a/src/components/HTMLEngineProvider/index.tsx b/src/components/HTMLEngineProvider/index.tsx index c178c9feea96..9addb549d13a 100755 --- a/src/components/HTMLEngineProvider/index.tsx +++ b/src/components/HTMLEngineProvider/index.tsx @@ -1,10 +1,10 @@ import React from 'react'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; +import type ChildrenProps from '@src/types/utils/ChildrenProps'; import BaseHTMLEngineProvider from './BaseHTMLEngineProvider'; -import type {HTMLEngineProviderProps} from './types'; -function HTMLEngineProvider({children = null}: HTMLEngineProviderProps) { +function HTMLEngineProvider({children}: ChildrenProps) { const {isSmallScreenWidth} = useWindowDimensions(); return {children}; diff --git a/src/components/HTMLEngineProvider/types.ts b/src/components/HTMLEngineProvider/types.ts deleted file mode 100644 index 6b8ee50b46d0..000000000000 --- a/src/components/HTMLEngineProvider/types.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type {TNode} from 'react-native-render-html'; -import type ChildrenProps from '@src/types/utils/ChildrenProps'; - -type HTMLEngineProviderProps = ChildrenProps; - -type Predicate = (node: TNode) => boolean; - -export type {HTMLEngineProviderProps, Predicate};