react-native-skeleton-placeholder icon indicating copy to clipboard operation
react-native-skeleton-placeholder copied to clipboard

Add children type to SkeletonPlaceholderItemProps to prevent warnings when nesting SkeletonPlaceholder.Item

Open shaunp-street opened this issue 2 years ago • 4 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

When nesting SkeletonPlaceholder.Item typescript errors occur as there is not children prop.

image

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts b/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
index 58cfac7..7c8fc8d 100644
--- a/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
+++ b/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
@@ -33,6 +33,7 @@ declare type SkeletonPlaceholderProps = {
 };
 declare type SkeletonPlaceholderItemProps = ViewStyle & {
     style?: StyleProp<ViewStyle>;
+    children?: JSX.Element[] | JSX.Element;
 };
 declare const SkeletonPlaceholder: React.FC<SkeletonPlaceholderProps> & {
     Item: React.FC<SkeletonPlaceholderItemProps>;

This issue body was partially generated by patch-package.

shaunp-street avatar Oct 21 '22 15:10 shaunp-street

This was required for me (parent placeholder element can take multiple children)

diff --git a/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts b/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
index 58cfac7..0fb7755 100644
--- a/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
+++ b/node_modules/react-native-skeleton-placeholder/lib/skeleton-placeholder.d.ts
@@ -4,7 +4,7 @@ declare type SkeletonPlaceholderProps = {
     /**
      * Determines component's children.
      */
-    children: JSX.Element;
+    children: JSX.Element[] | JSX.Element;
     /**
      * Determines the color of placeholder.
      */
@@ -33,6 +33,7 @@ declare type SkeletonPlaceholderProps = {
 };
 declare type SkeletonPlaceholderItemProps = ViewStyle & {
     style?: StyleProp<ViewStyle>;
+    children?: JSX.Element[] | JSX.Element;
 };
 declare const SkeletonPlaceholder: React.FC<SkeletonPlaceholderProps> & {
     Item: React.FC<SkeletonPlaceholderItemProps>;

sterlingwes avatar Nov 01 '22 12:11 sterlingwes

Same for me. Can somebody create PR for this bug?

Splicer97 avatar Nov 12 '22 16:11 Splicer97

I appreciate if somebody create a PR

chramos avatar Dec 15 '22 14:12 chramos

I appreciate if somebody create a PR

https://github.com/chramos/react-native-skeleton-placeholder/pull/109

Splicer97 avatar Dec 15 '22 16:12 Splicer97