react-native-markdown-display icon indicating copy to clipboard operation
react-native-markdown-display copied to clipboard

Update index.d.ts

Open CodingByJerez opened this issue 2 years ago • 4 comments

To fix the typescript error

CodingByJerez avatar Jul 31 '22 08:07 CodingByJerez

Bump

wooziet avatar Sep 14 '22 09:09 wooziet

found the same error and fixed it in the same way

MoonRainy21 avatar Oct 15 '22 17:10 MoonRainy21

Can we merge this please? Thanks!

Avishayy avatar Dec 24 '22 17:12 Avishayy

Another possible better fix is to just change the MarkdownStatic type to:

type MarkdownStatic = React.ComponentType<React.PropsWithChildren<MarkdownProps>>;

You can use patch-package to update this type with the following patch:

./patches/react-native-markdown-display+6.1.6.patch

diff --git a/node_modules/react-native-markdown-display/src/index.d.ts b/node_modules/react-native-markdown-display/src/index.d.ts
index eb9ff5b..4add358 100644
--- a/node_modules/react-native-markdown-display/src/index.d.ts
+++ b/node_modules/react-native-markdown-display/src/index.d.ts
@@ -93,7 +93,9 @@ export interface MarkdownProps {
   onLinkPress?: (url: string) => boolean;
 }
 
-type MarkdownStatic = React.ComponentType<MarkdownProps>;
+// Patch applied for allowing children of the MarkdownStatic component.
+// Remove patch when this PR is merged: https://github.com/iamacup/react-native-markdown-display/pull/178
+type MarkdownStatic = React.ComponentType<React.PropsWithChildren<MarkdownProps>>;
 export const Markdown: MarkdownStatic;
 export type Markdown = MarkdownStatic;
 export {MarkdownIt};

markrickert avatar Jan 23 '23 22:01 markrickert